EXECUTABLE & NONE EXECUTABLE FILES IN YOUR PATH BASH
- Fredrick Were
- Aug 4, 2018
- 1 min read
#!/bin/bash
#set -x
MYPATH="/opt/sysadmin/admin_tools/repos-software" myPath="$(echo $MYPATH | sed -e 's/ /~~/g' -e 's/:/ /g')" count=0; null=0
for dirname in $myPath; do dir="$( echo $dirname | sed 's/~~/ /g')" if [ -d "$dir" ]; then for mycomnd in $(ls "$dir"); do if [ -x "$dir/$mycomnd" ]; then count="$(( $count + 1))" else null="$(( $null +1 ))" fi done fi done
echo "You have $count commands in your Path and $null Enties that are not executable" exit 0

Comments