Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm converting Windows batch script .bat to Linux batch script .sh

What takes time a lot is to change the way .bat script use variables.


In Windows

@set varName=122
echo %varName%

In Linux

echo $varName

So the question is, how to replace %.+% to $.+ ?

share|improve this question
You should accept your own answer if you don't expect there to be another better solution. – JustinStolle Dec 4 '11 at 21:09

1 Answer 1

up vote 5 down vote accepted

In the Replace dialog (Ctrl+H), use the following:

Find what: %(.+)%
Replace with: $\1
Search Mode: Regular expression

screen shot of replace dialog

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.