Dumb Bash Script question
der.hans
PLUGd at LuftHans.com
Wed May 25 22:23:42 MST 2011
Am 25. May, 2011 schwätzte Dazed_75 so:
> In a bash script, how can I set the contents of a variable to the result of:
>
> mount | grep tftpboot | wc | cut -c 5-8
As Kevin already pointed out, use command substitution.
numlines=$( mount | grep tftpboot | wc | cut -c 5-8 )
In this particular case, you can shorten the pipeline.
numlines=$( mount | grep -c tftpboot )
You might even be able to just get the data directly from proc.
numlines=$( grep -c tftpboot /proc/mounts )
ciao,
der.hans
--
# http://www.LuftHans.com/ http://www.LuftHans.com/Classes/
# <arclight> Delicious red tape, like a Twizzler but flat. And adhesive.
More information about the PLUG-discuss
mailing list