Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to remove a trailing slash (/) at the end of dirname in tcsh

112 views
Skip to first unread message

Zhu Zhou

unread,
Dec 24, 2001, 12:53:47 AM12/24/01
to
Hi,
Just as title, are there any command in solaris which can do that easily
? or a walkaround is " how to 'ls' to let dirname output is not
followed with (/) ?
In my machine, the dirname always are always printed with a (/), but
some others are not , why ?

Thank u in advanced !

/zz


Erik Max Francis

unread,
Dec 24, 2001, 1:01:13 AM12/24/01
to
Zhu Zhou wrote:

> Just as title, are there any command in solaris which can do that
> easily
> ? or a walkaround is " how to 'ls' to let dirname output is not
> followed with (/) ?
> In my machine, the dirname always are always printed with a (/), but
> some others are not , why ?

Likely you have an alias in place for ls that calls ls with the -F
option. Just remove the alias.

--
Erik Max Francis / m...@alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/ \ Laws are silent in time of war.
\__/ Cicero
Esperanto reference / http://www.alcyone.com/max/lang/esperanto/
An Esperanto reference for English speakers.

Zhu Zhou

unread,
Dec 24, 2001, 1:24:56 AM12/24/01
to
Thanks,But i found it 's better for me not to change this alias,:(
so any other easy script solution to remove it ?

/zz

Chris F.A. Johnson

unread,
Dec 24, 2001, 4:11:16 AM12/24/01
to
On Mon, 24 Dec 2001, Zhu Zhou wrote:
> Erik Max Francis wrote:
>
> > Zhu Zhou wrote:
> >
> > > Just as title, are there any command in solaris which can do that
> > > easily
> > > ? or a walkaround is " how to 'ls' to let dirname output is not
> > > followed with (/) ?
> > > In my machine, the dirname always are always printed with a (/), but
> > > some others are not , why ?
> >
> > Likely you have an alias in place for ls that calls ls with the -F
> > option. Just remove the alias.
> >
[please don't top post]

>
> Thanks,But i found it 's better for me not to change this alias,:(
> so any other easy script solution to remove it ?

Use the full path to ls, e.g. /usr/bin/ls, or alias another command to
/usr/bin/ls.

If you have the path with a trailing slash in a variable:

case $var in
*/) var=${var%?} ;; ## any POSIX shell
## */) var=`expr $var : '\(.*\).` ;; ## non-POSIX shell:
esac

--
Chris F.A. Johnson http://cfaj.freeshell.org
===================================================================
My code (if any) in this post is copyright 2001, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License

Bruce Barnett

unread,
Dec 24, 2001, 6:42:10 AM12/24/01
to
"Chris F.A. Johnson" <c.f.a....@rogers.com> writes:

> Use the full path to ls, e.g. /usr/bin/ls, or alias another command to
> /usr/bin/ls.


Or just type

\ls

(works for C shell aliases)


--
Sending unsolicited commercial e-mail to this account incurs a fee of
$500 per message, and acknowledges the legality of this contract.

0 new messages