scripting part2 Flashcards
1
Q
what command do you run in a script to get input from a user?
A
read
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.
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”
4
Q
run a script with if else statements
A
lab
5
Q
run a script with for loops
A