[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: a quick Q: how to replace the value quickly



>>>>> John L Cunningham <djohngo@gmail.com> writes:
>>>>> On Sat, Sep 10, 2011 at 12:03:06AM +0800, lina wrote:

 >> suppose there is a variable in some bash like i, so in some process
 >> I used $i so lots,

 >> but I wanna test one long command on terminal,

 >> which as like

 >> run -a $i.pdf -b $i.pdf -c $i.pdf -d $i.pdf,

 >> how can I change $i very quickly except one by one to

 >> run -a 1.pdf -b 1.pdf -c 1.pdf -d 1.pdf,

 >> Thanks ahead for any suggestions,

 > export i=whatever_you_want_here

	One shouldn't use ‘export’ here, unless, of course, the intent
	is to pass this variable to all the processes started from
	within that shell.  Plain $ i=value will do, as in:

$ (i=world ; printf 'Hello, %s!\n' "$i") 
Hello, world!
$ 

	(The parentheses there ensure that the variable will be used for
	this command line only and will not linger.)

-- 
FSF associate member #7257	Coming soon: Software Freedom Day
http://mail.sf-day.org/lists/listinfo/ planning-ru (ru), sfd-discuss (en)


Reply to: