Red Hat Topics - Simple question

This is Interesting: Free IT Magazines  
Home > Archive > Red Hat Topics > March 2005 > Simple question





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Simple question
Cor van den Berghe

2005-03-07, 7:45 am

Can anybody tell me if there is a Linux command that gives the length of the
filename (including full path)

Tia

Cor van den Berghe
moma

2005-03-07, 5:45 pm

Cor van den Berghe wrote:
> Can anybody tell me if there is a Linux command that gives the length of
> the filename (including full path)
>
> Tia
> Cor van den Berghe


Do you mean bash, shell command?

http://linuxreviews.org/beginner/ab...e/en/x4299.html


FN="abcd.swx"

echo ${#FN}

$ echo "$FN" | awk '{print length()}'

$ echo $(expr length $FN)

$ ls | awk '{print $0,length($0)}'

Google search returns other variants too
$ echo `expr "$FN" : '.*'`


$ man dirname
$ man basename

------------------------------------
Good question, but u learn to google.
Spamless

2005-03-07, 5:45 pm

On 2005-03-07, moma <moma@example.net> wrote:
> Cor van den Berghe wrote:
>
> Do you mean bash, shell command?
>
> http://linuxreviews.org/beginner/ab...e/en/x4299.html
>
>
> FN="abcd.swx"
>
> echo ${#FN}
>
> $ echo "$FN" | awk '{print length()}'


You may have to suppress echo supplying an EOL marker (or be off one)
And how about the simpler"

echo -n "text" | wc -m

(Watch the version of echo and the switches.
The tcshell and bash have their own built in
versions different from the external /bin/echo)

(man wc)
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com