05-03-2013
Good post. I missed the subject title completely!
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I am doing below :
$HOST_NAME1="webisstg70"
$count=1
$echo $HOST_NAME1 $count
webisstg70 1
$HOST_NAME=""
$HOST_NAME=`echo '$HOST_NAME'${count}`
$echo $HOST_NAME
HOST_NAME1
$NODE_NAME=`echo $`echo ${HOST_NAME}``
I get below error message (2 Replies)
Discussion started by: findprakash
2 Replies
2. Shell Programming and Scripting
Hello
I have the following output which is returned with the Month in text format instead of numerical. The output I receive is performed by using Rational Synergy CM software commands from the Unix command line and piping Unix commands on the end.
bash-3.00$ ccm query -n... (4 Replies)
Discussion started by: Glyn_Mo
4 Replies
3. Shell Programming and Scripting
How can I nest substitutions ? My solution just seems cheap ...
sample data
Cisco Catalyst Operating System Software, Version 235.5(18)
Cisco Catalyst Operating System Software, Version 17.6(7)
Cisco Catalyst Operating System Software, Version 19.6(7)
Cisco Catalyst Operating System... (1 Reply)
Discussion started by: popeye
1 Replies
4. Shell Programming and Scripting
Is there anyway to accomplish this?
(ksh)
FILES_TO_PROCESS='NAME1 NAME2'
SOURCE_NAME1=/tmp/myfile
TARGET_NAME1=/somewhere/else
# other file names
for i in $FILES_TO_PROCESS
do
file1=SOURCE_$i
file2=TARGET_$i
echo cp ${$file1} ${$file2} <-- how do get this to work.
done (2 Replies)
Discussion started by: koondog
2 Replies
5. Shell Programming and Scripting
I am working on a bash script and ran around this issue. here's the code :
#!/bin/bash
string="\"bin\" \"barn\" \"bin, barn /\""
array=($string)
echo -e "\nMethod 1\narray is ---> ${array}"
echo -e "array=($string)"
array=("bin" "barn" "bin, barn /")
echo -e "\nMethod 2\narray is... (4 Replies)
Discussion started by: titou_dude
4 Replies
6. Shell Programming and Scripting
PHOST1=temp
i=1
I want to display the value of PHOST1 by making use of variable i inplace of 1
something like this
echo "$PHOST$i" # -> This doesn't seem to work.
Please provide me the correct syntax. I tried many different ways
echo ${PHOST${i}}
echo ${PHOST
Nothing seems... (6 Replies)
Discussion started by: blazer789
6 Replies
7. Shell Programming and Scripting
I have this XML file -
<gp>
<mms>1110012</mms>
<tg>988</tg>
<mm>LongTime</mm>
<lv>
<lkid>StartEle=ONE, Desti = Motion</lkid>
<kk>12</kk>
</lv>
<lv>
<lkid>StartEle=ONE, Source = Velocity</lkid>
<kk>2</kk>
</lv>
<lv>
... (3 Replies)
Discussion started by: NeedASolution
3 Replies
8. Shell Programming and Scripting
Hi all,
I have a lookup table from which I am looking up values (from col1) and replacing them by corresponding values (from col2) in another file.
lookup file
a,b
c,d
So just replace a by b, and replace c by d.
mainfile
a,fvvgeggsegg,dvs
a,fgeggefddddddddddg... (7 Replies)
Discussion started by: senhia83
7 Replies
9. Shell Programming and Scripting
Hello!
Below my first bash script. As you can see i build 2 nested cases. The second one (sync databases) is working fine. Bu the first one (sync datadirs) is not working. It says: rsync: command not found. However when i move the rsync command to the top of the script its working. So i suppose... (2 Replies)
Discussion started by: hyperconnected
2 Replies
10. Shell Programming and Scripting
Hi,
i want use this Comand for my psql request
sh ssh -o StrictHostKeyChecking=no rootatemailaddress.de sudo psql -U postgres -c "select pg_terminate_backend(pid) from pg_stat_activity where datnam=\'$DB\';"'"
but the shell lost the inverted comma for datnam=\'$DB\'. The request deliver... (2 Replies)
Discussion started by: peterpane007
2 Replies
expr(1) General Commands Manual expr(1)
Name
expr - evaluate expressions
Syntax
expr arg...
Description
The arguments are taken as an expression. After evaluation, the result is written on the standard output. Each token of the expression is
a separate argument.
The operators and keywords are listed below. The list is in order of increasing precedence, with equal precedence operators grouped.
expr | expr Yields the first expr if it is neither null nor 0. Otherwise yields the second expr.
expr & expr Yields the first expr if neither expr is null or 0. Otherwise yields 0.
expr relop expr The relop is one of < <= = != >= > and yields 1 if the indicated comparison is true, '0' if false. The comparison is
numeric if both expr are integers, otherwise lexicographic.
expr + expr
expr - expr
Yields addition or subtraction of the arguments.
expr * expr
expr / expr
expr % expr
Yields multiplication, division, or remainder of the arguments.
expr : expr The matching operator compares the string first argument with the regular expression second argument; regular expres-
sion syntax is the same as that of The (...) pattern symbols can be used to select a portion of the first argument.
Otherwise, the matching operator yields the number of characters matched ('0' on failure).
( expr ) parentheses for grouping.
Examples
The first example adds 1 to the Shell variable a:
a=`expr $a + 1`
The second example finds the file name part (least significant part) of the pathname stored in variable a,
expr $a : '.*/(.*)' '|' $a
Note the quoted Shell metacharacters.
Diagnostics
The command returns the following exit codes:
0 The expression is neither null nor '0'.
1 The expression is null or '0'.
2 The expression is invalid.
See Also
ed(1), sh(1), test(1)
expr(1)