linux shell: Concatenate instruction and file

tobor :

How do I concatenate the following alias (in .bashrc) with the file located in ~/Downloads/?

alias inst=`instruction ~/Downloads/`

I want to run the command in this way:

inst file
ErikMD :

What you want to achieve is not directly possible with an alias.

Indeed, the approach you suggest

alias inst='instruction ~/Downloads/'  # with single quotes, not backquotes!
inst file

will amount to

instruction ~/Downloads file  # with a space

Instead, you can consider adding a function in your .bashrc:

inst() {
    instruction ~/Downloads/"$1"
}

Then, run the command in this way:

inst file

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=32981&siteId=1