top of page

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

Couldn’t Load Comments
It looks like there was a technical problem. Try reconnecting or refreshing the page.

©2018 by OPEN LINUX LEARNING. Proudly created with Wix.com

bottom of page