LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   a single command the spans more then 1 line (https://www.linuxquestions.org/questions/programming-9/a-single-command-the-spans-more-then-1-line-602329/)

bourne 11-25-2007 08:39 PM

a single command the spans more then 1 line
 
hey guys whats up. I am currently writing a bash script for school, I am still pretty new at scripting so this is all pretty new to me. Anyways, I have this command that is reeaally big, its actually an echo command piped into an awk command. My issues is that the command spans multiple lines and its looks ugly and is hard to edit. so right now it looks like this:
Code:

echo $blah $blah $blah | awk -F {blah blah blah blah blah blah blah blah blah blah blah blah blah}
I would like to set it so that its nice and neat on multiple lines..if i can, i would like to have it look like this:
Code:

echo $blah $blah $blah |
awk -F { blah...........................}

I haven't been able to find away to tell the system that it is all one command. I know that you can do something similar in the command line, but i am unsure of how i can do it in my script or even if i can. I am currently using VIM to code my script (its the only text editor i know well for right now).

If there is away to do what I am explaining here any advice would be welcomed.

Thanks in advance
todd

pixellany 11-25-2007 08:57 PM

The ubiquitous "escape" ("\")

I just tried it in interactive mode--I'm assuming it works the same in a script.

bourne 11-25-2007 09:08 PM

Quote:

Originally Posted by pixellany (Post 2970619)
The ubiquitous "escape" ("\")

I just tried it in interactive mode--I'm assuming it works the same in a script.

oh nice man i think that that worked. I just tried it on a little mini script i put together to try and test for it. I will try it in my main script and see what i get and get back to you

thanks
todd

bourne 11-25-2007 09:10 PM

amazing news, that worked like a charm man thanks so much. Now i can actually edit the code properly lol

thanks again dude you just saved me a huge headache
todd

bigearsbilly 11-27-2007 05:50 AM

well, if it's a pipe you can

Code:

do_this |
do_that |
and_this  > file

for example


All times are GMT -5. The time now is 07:21 PM.