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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what ist the one line for loop syntax

A

for NAME [in WORDS … ] ; do COMMANDS; done

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what is the handle for all arguments passed to a bash function?

A

$@

How well did you know this?
1
Not at all
2
3
4
5
Perfectly