View Single Post
  #1   (View Single Post)  
Old 31st August 2010
guitarscn guitarscn is offline
Package Pilot
Join Date: Oct 2008
Posts: 166
Default [Solved] How to make 2 separate arguments in 1 bash script?

This is what I have:


WORD1=`tail -n +$1 /home/gscn/word1.txt | head -1`
sed -e "s/WORD1/$WORD1/g" < /home/gscn/configtmp > /home/gscn/config

WORD2=`tail -n +$1 /home/gscn/word2.txt | head -1`
sed -e "s/WORD2/$WORD2/g" < /home/gscn/config2tmp > /home/gscn/config2
When I do:
$ ./ 1
It'll take the first word of both word1.txt and word2.txt files and put them in their respective config files. How do I make them separate? Like I want it so that I can do:
$ ./ 1 5
Which will take the first word of the first word1.txt and put it in the respective config file, then take the fifth word of word2.txt and put it in the respective other config file. How can I achieve this?
Reply With Quote