I have a file called Namebook, with following data inside:
$ cat Namebook
Kamala Hasan 123
Rajini kanth 345
Vijay 567
Ajith kumar 908
$
Then I have a bash script to add a new name in the file Namebook, called add_name.sh
$ cat add_name.sh
#!/bin/bash
echo "$1 $2" >> Namebook
$
Next I have a script to look someone from this Namebook, called look_up.sh
$ cat look_up.sh
#!/bin/bash
grep "$1" Namebook
$
Then again I have a script to remove someone from this Namebook, called remove.sh
$ cat remove.sh
#!/bin/bash
grep -v "$1" Namebook > tmp/Namebook
mv tmp/Namebook Namebook
$
These scripts add, lookup and remove users from the Namebook file.
Based on the combination of these three script, I created a single script, all_action.sh, to perform all said actions
$cat all_action.sh
#!/bin/bash
echo 'Select the option
1. Lookup some one from the Namebook
2. Add name to Namebook
3. Remove name from the Namebook
Select the options range of (1-3): \c '
read choice
case "$choice"
in
1) "Enter the name to lookup: \c"
read name
look_up "$name" ;;
2) "Enter the name to be add: \c"
read name
"Enter the number to be add: \c"
read number
add_name "$name" "$number" ;;
3) "Enter the name to be remove: \c"
read name
remove "$name ;;
esac
My question: when I execute the program all_action.sh, it throws an error
For example: I am going to run ./all_action.sh
Select the option
1. Lookup some one from the Namebook
2. Add name to Namebook
3. Remove name from the Namebook
Select the options range of (1-3): \c
1
Enter name to be lookup
Kamala Hasa
./all_action.sh: line no : look_up: command not found
Could you please any one help on this ?