LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 11-25-2007, 08:39 PM   #1
bourne
Member
 
Registered: Feb 2006
Location: Toronto, Ontario
Distribution: Fedora 10, centos
Posts: 181

Rep: Reputation: 30
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

Last edited by bourne; 11-25-2007 at 08:47 PM.
 
Old 11-25-2007, 08:57 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
The ubiquitous "escape" ("\")

I just tried it in interactive mode--I'm assuming it works the same in a script.
 
Old 11-25-2007, 09:08 PM   #3
bourne
Member
 
Registered: Feb 2006
Location: Toronto, Ontario
Distribution: Fedora 10, centos
Posts: 181

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by pixellany View Post
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
 
Old 11-25-2007, 09:10 PM   #4
bourne
Member
 
Registered: Feb 2006
Location: Toronto, Ontario
Distribution: Fedora 10, centos
Posts: 181

Original Poster
Rep: Reputation: 30
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
 
Old 11-27-2007, 05:50 AM   #5
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,269

Rep: Reputation: 165Reputation: 165
well, if it's a pipe you can

Code:
do_this |
do_that |
and_this  > file
for example
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command line screenshot of a single window Hko Programming 2 11-09-2010 08:01 PM
Is there a single command to list all hardware installed (command line)? davee Linux - Hardware 6 02-28-2009 07:19 PM
xine command line? or some other command line only engine? lumix Linux - Software 2 08-10-2007 10:46 AM
Single line of HTML to crash IE-6. Hitboxx General 1 08-07-2007 11:49 AM
Retrieve only a single line from a file rose_bud4201 Programming 4 06-22-2005 06:26 PM


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

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration