Results 1 to 5 of 5
search_proc () {
outputfile3=$3
clear
echo 'Type Proccess name to search for then press ENTER '
ps -ewwo pid,args | grep $outputfile3 | awk '{print $1}'
}
I have created ...
- 06-09-2011 #1Just Joined!
- Join Date
- Jun 2011
- Posts
- 4
Variables within a sub menu problems
I have created a menu and this submenu. What i bascially need to do is have it accept a variable once it goes too this menu and do this. Any help is appreciated.search_proc () {
outputfile3=$3
clear
echo 'Type Proccess name to search for then press ENTER '
ps -ewwo pid,args | grep $outputfile3 | awk '{print $1}'
}
ps -ewwo pid,args | grep $outputfile3 | awk '{print $1}'
- 06-09-2011 #2Just Joined!
- Join Date
- Jun 2011
- Posts
- 4
I am still a newby and learning. The menu does not stay at that screen either, not sure what i did wrong. Thanks in advance.
- 06-09-2011 #3Linux Guru
- Join Date
- May 2011
- Posts
- 1,843
It is not clear to me what you are trying to do. Are you trying to get input from the user, save it to a variable, and then run your ps|grep|awk command against that? If so, check out the read shell builtin command provided with bash. If you mean something else, please elaborate.
- 06-09-2011 #4Just Joined!
- Join Date
- Jun 2011
- Posts
- 4
Yes that is what i'm trying to do. What are you saying i need to read?
- 06-09-2011 #5Linux Guru
- Join Date
- May 2011
- Posts
- 1,843
literally, you use the read command in your shell script to get the user input stored as a variable, e.g.:
for more, man bash and look for the 'read' entry under the section SHELL BUILTIN COMMANDS.Code:read -p "Tell me something funny " joke echo You said $joke


Reply With Quote