samedi 3 janvier 2015

How to use passed-in parameters for shell script?


I know little about shell script but I want to try to implement some complicated scripts.


Say I have a doitall.sh with the content like:



zip -j version_a_en.zip en_filea1.txt en_fileb2.json


And a doitall2.sh with the content like:



zip -j version_b_en.zip en_fileb1.txt en_fileb2.json


How can I use "a" and "en" as parameters so that I can use only one script to handle all the similar requirements. Like



./doitall.sh a en


or



./doitall.sh b fr


Aucun commentaire:

Enregistrer un commentaire