bash expansion not working as expected! o.O

Forum rules
Before you post please read how to get help

bash expansion not working as expected! o.O

Postby tessiof on Tue Sep 25, 2012 3:53 pm

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.
tessiof
Level 1
Level 1
 
Posts: 7
Joined: Thu Aug 16, 2012 8:56 pm

Linux Mint is funded by ads and donations.
 

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

Postby DrHu on Tue Sep 25, 2012 4:07 pm

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
User avatar
DrHu
Level 17
Level 17
 
Posts: 7098
Joined: Wed Jun 17, 2009 8:20 pm

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

Postby rich2005 on Tue Sep 25, 2012 4:38 pm

perhaps instead of ls /usr/bin use
find /usr/bin
rich2005
Level 3
Level 3
 
Posts: 183
Joined: Sun Nov 07, 2010 5:22 am

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

Postby tessiof on Tue Sep 25, 2012 10:26 pm

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)
tessiof
Level 1
Level 1
 
Posts: 7
Joined: Thu Aug 16, 2012 8:56 pm

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

Postby tessiof on Wed Sep 26, 2012 8:08 am

Never mind! The "problem" is that Mint has a sub-directory (/usr/bin/X11) in '/usr/bin/', instead of only files as I supposed.
tessiof
Level 1
Level 1
 
Posts: 7
Joined: Thu Aug 16, 2012 8:56 pm


Return to Scripts & Bash

Who is online

Users browsing this forum: No registered users and 2 guests