|
Search Forums:
|
|||||||
| Forums | Register | Forum Rules | Linux and Unix Links | Man Pages | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Help Needed with Shell Script Variable
ok, so, i want to do something like this where i store results of codings in a variable, but when i run it, it doesn' twork: example Code:
HOT=34 BOSS=`john=133 if [ "$john -eq 133 ] ; then ADDIT=`expr 8 + 6` case $HOT in 34) expr 4 + 5 ;; esac fi` it seems shell scripts have a problem with having `` occur more than once. does anyone know a way around this? i want to be able to execute another command or action within a `` . i hope you understand what i'm asking. Last edited by pludi; 03-12-2010 at 12:08 PM.. Reason: code tags, please... |
| Sponsored Links | |
|
|
|
#2
|
||||
|
||||
|
Yes, that's right, backticks can't be nested. Which is why just about any shell gives you a warning when running the syntax check (eg. 'ksh -n yourscript.sh') that backticks should be replaced by the $(...) construct, which is nestable.
|
| Sponsored Links | ||
|
|
|
#3
|
||||
|
||||
|
Code:
#!/bin/somesh (bash,dash,ksh,sh,...)
HOT=34
############################
dosome()
{
john=133
if [ "$john" -eq 133 ]
then
ADDIT=$((8 + 6))
case "$HOT" in
34) echo $((4 + 5)) ;;
esac
fi
}
############################
BOSS=$(dosome)
echo "$BOSS" |
| Sponsored Links | ||
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help with Shell Script Needed | infinity2030 | Shell Programming and Scripting | 1 | 03-06-2009 01:56 AM |
| help needed for a shell script | revenna | Shell Programming and Scripting | 0 | 12-11-2008 01:33 AM |
| Help needed for Shell Script..... | pulkit | Shell Programming and Scripting | 0 | 02-22-2008 06:25 AM |
| shell script Help Needed!! | smallu | UNIX for Dummies Questions & Answers | 0 | 01-15-2008 07:40 PM |
| shell script help needed | fastgoon | Shell Programming and Scripting | 3 | 07-17-2006 04:24 PM |
|
|