Linux / UNIX Tech Support Forum
This is a discussion on example for string connect to a command. within the Shell scripting forums, part of the Development/Scripting category; here is a example for str+str=command, ###script 1### str1='ls' str2='-l' str3="$str1 $str2" #notice the formular $str3 ###script 2### if debugout=true ...
Register free or login to your account to remove all advertisements.
|
|||||||
| Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques |
![]() |
|
|
Thread Tools | Display Modes |
|
|||
|
here is a example for str+str=command,
###script 1### str1='ls' str2='-l' str3="$str1 $str2" #notice the formular $str3 ###script 2### if debugout=true ; then str1=' ' else str1='#' fi str2='echo this is debug output' str3="$str1 $str2" $str3 but actually, when str1=#, I got following err "# is not recognized" who have any idea ,pls share with me. THanks vivi[/quote] |
|
|||
|
I think you need something as follows:
Code:
debug="0" # 0 - true, nonzero = false str1='ls' str2='-l' str3="$str1 $str2" #notice the formular [ "$debug" == "0" ] && echo "$str1 $str2 $str3" || $str3 |
|
|||
|
right, it achieved what I want.
Quote:
|
![]() |
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| split files by specifying a string (bash shell) | vikas027 | Shell scripting | 7 | 21st June 2010 12:35 PM |
| Not able to connect using remote desktop | aliment | CentOS / RHEL / Fedora | 0 | 14th April 2008 12:42 PM |
| fedora 7 connect dsl-502T | anthony pereira | Getting started tutorials | 4 | 22nd December 2007 02:10 PM |
| Connect mysql in c | raj | Databases servers | 1 | 10th August 2007 08:10 PM |
| linux command search server for string | chimu | Linux software | 2 | 26th July 2006 12:40 AM |