Thanks guys. That worked. I must have done something syntactly wrong
because I tried a number of variations on that theme which did not work.
Also, thanks to Hans as I did not know about the -c option for grep.
The last option Hans provided does not give the desired because /proc/mounts
apparently includes contents from any autofs map files:
larry@fogtest:~$ grep tftpboot /proc/mounts
/etc/auto.fedora /tftpboot/iso/fedora autofs
rw,relatime,fd=6,pgrp=1673,timeout=300,minproto=5,maxproto=5,indirect 0 0
/etc/auto.puppy /tftpboot/iso/puppy autofs
rw,relatime,fd=14,pgrp=1673,timeout=300,minproto=5,maxproto=5,indirect 0 0
/etc/auto.ubuntu /tftpboot/iso/ubuntu autofs
rw,relatime,fd=20,pgrp=1673,timeout=300,minproto=5,maxproto=5,indirect 0 0
/etc/auto.mint /tftpboot/iso/mint autofs
rw,relatime,fd=26,pgrp=1673,timeout=300,minproto=5,maxproto=5,indirect 0 0
/etc/auto.zorin /tftpboot/iso/zorin autofs
rw,relatime,fd=32,pgrp=1673,timeout=300,minproto=5,maxproto=5,indirect 0 0
/dev/loop0 /tftpboot/iso/mint/mint11DL32 iso9660 ro,relatime 0 0
/dev/loop2 /tftpboot/iso/mint/mint10DL32 iso9660 ro,relatime 0 0
On Wed, May 25, 2011 at 10:23 PM, der.hans <
PLUGd@lufthans.com> wrote:
> 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.
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>
--
Dazed_75 a.k.a. Larry
The spirit of resistance to government is so valuable on certain occasions,
that I wish it always to be kept alive.
- Thomas Jefferson
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss