LINUX
- The fo rloop can be used to iterate through the currentdirectory to check file permissions. To print all fileswith execute permission:
#!/bin/bash
for i in *; do
if [ -x $i ];then
echo$i
fi
done
- Writeanewscript,script7.shthatincludes the above code. 9) What printsout? Modify the script to print out all files withwrite permission. 10) What flag did you use to checkthat a file has write permission?
- 11) Include a copy this script in youranswerfile.
Solution
9)
Please find the required program along with the output:
script7.sh
————–
#!/bin/bash
for i in *; do
if [ -x $i ]; then
echo $i
fi
done
OUTPUT:
10)
OR
OR