I have an executable that I use often:

/dir1/dir2/dir3/dir4/executable argv[1] argv[2] argv[3]

I know that I can set an alias for the executable:

alias myexecutable = '/dir1/dir2/dir3/dir4/executable'

and then call it

myexecutable argv[1] argv[2] argv[3]

However, I'd like to call it like this

myexecutable argv[1]

because the first argument is the only one that ever changes. The second and third one should always be passed as the same every time.


Aliases don't handle arguments. Define a function:

myfunc () {
    /dir1/dir2/dir3/dir4/executable "$1" fixed-argv2 fixed-argv3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.