bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Quotes problem ?


From: Paul Jarc
Subject: Re: Quotes problem ?
Date: Wed, 10 Jan 2007 17:13:09 -0500
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.4 (gnu/linux)

Markos <address@hidden> wrote:
> #Delete "logo_1.gif" string from every line in results_1,
> #leaving only the path to prepare for "cd" step
>
> sed 's/logo_1.gif//' /tmp/results_1 >/tmp/results

This would be more precisely expressed as:
sed 's:/logo_1\.gif$:/:' /tmp/results_1 >/tmp/results

If you happen to have a directory contining "logo_1.gif" in its name,
your version won't do what you want.

> sed -n $line_number"p" /tmp/results >"$path"

">" doesn't do what you want.  It redirects the output of a command to
a file.  If you want to store the output in a shell variable, use
this:
path=$(sed -n "$line_number"p /tmp/results)

> #We change to dir stored in the path variable
>
> cd $path

Quotes would be useful here, in case you have a directory name
containing spaces.


paul




reply via email to

[Prev in Thread] Current Thread [Next in Thread]