Shortcut in nano editor for adding quotation marks to every word beginning with $ in a bash script? -
I'm new to writing in Bash and I've just finished this long script but I have given the quotation marks to all Adding all the quotation marks by the variable hand starting with Unary operator $
will take some time. Can a small cut be used on it so that all the words in the text file begin with $
, find the quotation marks around them? So if a line appears in the file:
dragon myProgue.py $ car1 $ car2 $ speed1 $ speed2
then it will appear after the shortcut As
/ Pre>
I am writing scripts through Nano.
Use global search and replace with expression (\ $ \ w +) < / Code>.
- Switch to search and replace mode with
c - << / code>.
- Switch to regex mode with
Alt-R
. - Type the expression
(\ $ \ w +)
. Press enter. - In the replacement expression type
"\ 1"
change the expression captured with citations. - On mail, press
A
for everyone.
Comments
Post a Comment