Linux, How to Execute an Executable/Non-Executable File

Using the ls command to hide non-executable files

The way to go :

for file in *; do test -x "$file" || echo "$file"; done

Thanks to not parsing ls output

Linux/bash does not execute the executable that which tells me

Bash caches the location of commands. Use hash foo to force it to update the cache.

Also, which is a separate command that doesn't tell you where your shell is actually looking; it just consults the $PATH environment variable. In bash, you should use type instead:

$ type foo
foo is hashed (/a/foo)

Running executable file with additional options or arguments

I suggest you use

sh -c "$mp2 $myfile -m mymode"

instead of just

"$mp2 $myfile -m mymode"


Related Topics



Leave a reply



Submit