DaemonForums  

Go Back   DaemonForums > Miscellaneous > Programming

Programming C, bash, Python, Perl, PHP, Java, you name it.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #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:

Code:
#!/bin/bash
#ascript.sh

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

tscript.sh
When I do:
Code:
$ ./ascript.sh 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:
Code:
$ ./ascript.sh 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
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I make this shell script faster? backrow Programming 3 18th July 2010 11:34 PM
xterm + bash: Make <DEL> delete char under cursor taylor_venable OpenBSD General 7 13th December 2008 11:53 PM
Adding a separate /home JMJ_coder NetBSD General 2 29th August 2008 10:45 AM
/etc on a separate partition DarkEnergy FreeBSD Installation and Upgrading 13 20th May 2008 04:24 AM


All times are GMT. The time now is 06:59 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick