On Tue, 30 Sep 2003, Bart Oldeman wrote:

> On Tue, 30 Sep 2003, Robert Komar wrote:
>
> > this doesn't look like it will work if there is a space somewhere in
> > the path.  If awk is available on every system, then how about this:
> >
> > BOOT_DIR_PATH=`ls -l $HOME/.dosemu/drives/c | awk -F"-> " '{ print $2 }'`/..
> >
> > It uses "-> " as the field separator instead of the space.  On my system,
> > the last '/' isn't required (the contents of the link already have a
> > trailing slash), but I guess it doesn't hurt to leave it there.
>
> but this won't work if there is " -> " somewhere in $HOME ;)
>
> How about
> BOOT_DIR_PATH=`cd "$HOME/.dosemu/drives" && ls -l c | sed 's/.* -> //'`/..
> in this case the source filename in "ls" won't have spaces.
>
> That'll work as long as no user name or group name or month (in some
> language) has " -> " in it.

Yes, I think this will work.  Replacing '{ print $2 }' with '{ print $NF }'
in the awk script would also work as well, but it's six of one and half a
dozen of the other.  Whichever you're happier to maintain.

Cheers,
Rob Komar
-
To unsubscribe from this list: send the line "unsubscribe linux-msdos" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to