[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cobalt-users] Shell script
- Subject: Re: [cobalt-users] Shell script
- From: Bruce Timberlake <bruce@xxxxxxxxxx>
- Date: Sat Jan 25 12:35:00 2003
- Organization: BRTNet.org
- List-id: Mailing list for users to share thoughts on Sun Cobalt products. <cobalt-users.list.cobalt.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> > Now, I want to "echo" the FIRST line, so the FIRST FILE..
> > $VARIABLE[0] or whatever does not work with shell...
> > Does anyone have a quick hint maybe? :)
>
> #/bin/bash
> for VARIABLE in *
> do
> echo $VARIABLE
> done
Doh... that should be
#!/bin/bash
for VARIABLE in "*"
do
echo VARIABLE
done
The "" around the wildcard ensure filenames with spaces get grabbed as
well...
Also, "*" won't give you any files which start with ".", so you'd have
to do a separate check for those:
#!/bin/bash
for DOTFILES in ".*"
do
echo $DOTFILES
done
- --
Bruce Timberlake
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+MvTyvLA2hUZ9kgwRAldtAJsG3NFJEf1E7zgQhKgm/IdxLPwZWQCfeQI6
ZPssu0ELg9tP7kS8bY7SAPs=
=8fCH
-----END PGP SIGNATURE-----