[Solved] Explain Bash Script Bin Bash X 0 Y 0 Ne 1 Echo Usage 0 Requires Path Exit 200 Fi D 1 Cat E Q37241828
Explain the bash script below:
#!/bin/bash
x=0
y=0
if [[ $# -ne 1 ]]; then
echo “usage: $0 requires apath”
exit 200
fi
if [[ -d $1 ]]; then
cat /etc/group | while read line;do
group=$(echo$line | awk -F: ‘{print $1}’)
gid=$(echo$line | awk -F: ‘{print $3}’)
if [[ “$gid”-ge 500 ]]; then
if[[ ! -e “$1/$group” ]]; then
mkdir”$1/$group”
x++
else
y++
fi
fi
done
printf “$x created, & $y alreadyexistedn”
else
printf “Problem with$1:n
doesnot existn
isa symbolic linkn
isnot a directoryn”
fi
exit0
Expert Answer
Answer to Explain the bash script below: #!/bin/bash x=0 y=0 if [[ $# -ne 1 ]]; then echo “usage: $0 requires a path” exit 2… . . .
OR

