bash expansion not working as expected! o.O

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
tessiof

bash expansion not working as expected! o.O

Post 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.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
DrHu

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

Post 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
rich2005

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

Post by rich2005 »

perhaps instead of ls /usr/bin use
find /usr/bin
tessiof

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

Post 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)
tessiof

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

Post 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.
Locked

Return to “Scripts & Bash”