accessing variables inside a function
#!/bin/bash
extractor() { FILES=`ls -l |awk '/^-/ {print $9}'` SUBDIR=`ls -l |awk '/^d/ {print $9}'` } looper() { for FIL in $FILES do permissions.sh $FIL $3 done for DIR in $SUBDIR do echo " the permissions being passed to other script are $2" permissions.sh $DIR $2 search.sh $DIR $2 done } echo " Processing the directory $1" cd "$1" extractor looper -------------------------------------------------------------------------------------------------------------------- when i try to pass the $3 in the looper function it is not able to acces the variable $3 . why cant that function access that variable? |
afaik the $3 would be the third parameter passed to that specific function. why not save $3 as a sane variable when the script starts? $perms=$3 etc...
|
All times are GMT -5. The time now is 12:13 AM. |