I don't if this method is applicable or not.
#!/bin/bash
file=$1
if [[ -x "$file" ]]
then
if [ $? = 0 ]
then
echo $file is executable
else
echo $file is not executable
fi
fi
But if i run this script with a non executable file it returns nothing But if i run this script with a executable file it returns "name is executable"
just want to know about positional parameter working. i'm a beginner.but can i take the output of the first if condition into $?
Aucun commentaire:
Enregistrer un commentaire