[linux] scripting newbie
Matus UHLAR - fantomas
uhlar na fantomas.sk
Čtvrtek Červen 17 15:18:00 CEST 2004
> On Thu, Jun 17, 2004 at 03:06:47AM +0200, Tomas Zatko wrote:
> > #!/bin/sh
> > # /etc/init.d/captive: mount or umount the captive-ntfs
> > # Written by WooDy
> >
> > export MOUNT_DEV=`grep ntfs /etc/fstab| awk '{ print $1 }'`
> > export MOUNT_POINT=`grep ntfs /etc/fstab| awk '{ print $2 }'`
On 17.06 12:31, Lubomir Host wrote:
> jednoduchsie a rychlejsie:
>
> export MOUNT_DEV=`awk '/ntfs/ { print $1 }' /etc/fstab`
a zase prikaz:
awk '$0 ~ /^\s*#/ {next} $3 == "ntfs" { print $0 }'
rata do uvahy komentovane riadky a funguje len v pripade ze 'ntfs' je
presna hodnota pola filesystem ;)
a mozes to dat do takejto rury:
awk '$0 ~ /^\s*#/ {next} $3 == "ntfs" { print $0 }' | while read line
do
set $line
echo "filesystem $1 sa mountuje na cestu $2 s parametrami $4"
done
ale to som uz odosielatelovi napisal osobne ;-)
--
Matus UHLAR - fantomas, uhlar na fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
Save the whales. Collect the whole set.
Další informace o konferenci linux