Page 1 of 1

bash expansion not working as expected! o.O

Posted: Tue Sep 25, 2012 3:53 pm
by tessiof
Hello,
First of all, I'm using Mint 12.

This command

Code: Select all

ls /usr/bin/*
is supposed to return the full path name of the files in /usr/bin directory. But it is returning only the base names.

This is a basic command. This works fine in Fedora. Why is it not working in Mint?

Ps. Remember that the wildcard is expanded before ls receive its parameters.

Re: bash expansion not working as expected! o.O

Posted: Tue Sep 25, 2012 4:07 pm
by DrHu

Code: Select all

ls /usr/bin
Simply lists the files in that directory, you already know the PATH, that is /usr/bin
--you also don't need the * selection

I think it is not the ls command in itself, but fedora's file system hierarchy method
--where Fedora places their file choices in reference to the FHS system to be compatible with it
https://en.wikipedia.org/wiki/Filesyste ... y_Standard

http://docs.fedoraproject.org/en-US/Fed ... m-fhs.html

Re: bash expansion not working as expected! o.O

Posted: Tue Sep 25, 2012 4:38 pm
by rich2005
perhaps instead of ls /usr/bin use
find /usr/bin

Re: bash expansion not working as expected! o.O

Posted: Tue Sep 25, 2012 10:26 pm
by tessiof
I just curious why this works in fedora, but not in Mint. This is a completely valid shell code.

Code: Select all

file $(ls /usr/bin/* | grep zip)

Re: bash expansion not working as expected! o.O

Posted: Wed Sep 26, 2012 8:08 am
by tessiof
Never mind! The "problem" is that Mint has a sub-directory (/usr/bin/X11) in '/usr/bin/', instead of only files as I supposed.