S
S
Sergey Burduzha2019-11-07 21:22:34
bash
Sergey Burduzha, 2019-11-07 21:22:34

How to write a function in bash in the terminal, where there will be 2 parameters?

Good evening.
Created a function to write git commit in the terminal

gitcommit() {
    git commit -m "$*"
}

Now I just write. Now I
gc описиние комита
need to come up with a function where 2 parameters will be passed, a function for optimizing images.
Here is what I have written so far.
jpg() {
  jpegoptim --strip-all --all-progressive -ptm "$*"
}
alias j='jpg'

Only I want to write j in the terminal and jpegoptim --strip-all --all-progressive -ptm 'image quality' + image name was executed.
You understand, where the dollar is, there is quality, but one more argument is needed, where the name of one image or the * *.jpg mask will be, and so on.
Thanks in advance for your help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2019-11-07
@serii81

This?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question