Advanced bash Flashcards
1
Q
build simple yes/no question into script
A
read -p “Do you want to do whatever? (n/y)” yn
case $yn in
y|Y)
yes-command
;;
n|N)
no-command
;;
esac
2
Q
what ist the one line for loop syntax
A
for NAME [in WORDS … ] ; do COMMANDS; done
3
Q
in a one line for loop, copy the file box1.s4d.txt seven times to have box2.s4d.txt, box3.s4d.txt, …
A
for i in {2..8}; do cp box1.s4d.txt box${i}.s4d.txt; done;
4
Q
what is the handle for all arguments passed to a bash function?
A
$@