scripting part2 Flashcards

1
Q

what command do you run in a script to get input from a user?

A

read

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

create a sample script using the read command.

A

!/bin/bash

  • touch a file

echo “hello, it is nice to meet you. What is your name? “
read name
echo” Hello $name I’m glad you’re here”

  • give it the proper permission
  • execute the script.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

create another script, define variables and use the read statement.

A
  • touch a file
    #!/bin/bash

a= apple

echo “my favorite fruit is $a what is your favorite food? “

read -p “my favorite food is “ food

echo “oh wow i love $food as well”

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

run a script with if else statements

A

lab

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

run a script with for loops

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