[ale] Looking for a one line script
Jerry Yu
jjj863 at gmail.com
Mon Jun 13 20:49:11 EDT 2005
The bash built-in should do the job:
i=/path/to/some/random/file.ext
pathOnly=${i%/*}
On 6/13/05, James Sumners <james.sumners at gmail.com> wrote:
>
> I need to get the base path of a filename. For example, if I have
> "/path/to/some/random/file.ext" I need to trim off "file.ext" so that
> I am left with "/path/to/some/random/". However, the filename could
> contain spaces and other odd characters. Any suggestions?
>
> --
> James Sumners
> http://james.roomfullofmirrors.com/
>
> "All governments suffer a recurring problem: Power attracts
> pathological personalities. It is not that power corrupts but that it
> is magnetic to the corruptible. Such people have a tendency to become
> drunk on violence, a condition to which they are quickly addicted."
>
> Missionaria Protectiva, Text QIV (decto)
> CH:D 59
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ale
mailing list