LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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
  Search this Thread
Old 02-13-2006, 09:36 PM   #1
ckoniecny
Member
 
Registered: Oct 2005
Posts: 162

Rep: Reputation: 30
Long IF Statement + ZSH


Here is my long IF statement. How can I break this into multiple lines so I don't have to stretch my terminal window so its 1800 pixels wide?

Code:
if [ `cat /proc/net/wireless | grep -c wlan0` -ne "0" ] && [ -f "/etc/dhcpc/dhcpcd-$INTERFACE.pid" ] && [ `ifconfig wlan0 | grep inet | gawk -F: '{print $2}' | gawk '{print $1}' | gawk -F. '{print $1}'` -eq "192" ]
...
fi
Thanks!
Chris
 
Old 02-13-2006, 10:16 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Fold it on the '&&' eg

Code:
if [[ 1 -eq 1 ]] &&
   [[ 2 -eq 2 ]]
then
    echo "true"
fi
 
Old 02-13-2006, 10:30 PM   #3
ckoniecny
Member
 
Registered: Oct 2005
Posts: 162

Original Poster
Rep: Reputation: 30
Thanks, I guess I didn't realize you could do that.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
zsh as root? abrouwers Slackware 7 08-13-2005 03:14 PM
Bash or Zsh reddazz Linux - General 5 05-27-2005 08:16 AM
zsh transparency Ops Linux - Software 1 07-08-2004 10:01 AM
ZSH Highlighting chrisk5527 Linux - General 2 02-28-2004 09:23 AM
Zsh rch Linux - General 0 05-22-2003 03:59 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:30 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration