On Solaris, using /bin/sh (definitely a good old-fashioned Bourne shell):
Gives:
bad substitution
Simplifying, by changing the ${x%.*.?} to ${x%there} gives the same response.
If I use ksh:
I properly get: x is: hellothere, y is: hello. Bash works, as well. Looks like it's pattern matching only.
But assuming that regular expressions are supported, I'll test
...This should match "1 of anything, followed by 0 or more instances of anything." That is, y should be completely empty. Testing with sh, ksh, and bash:
sh gives "bad substitution"
ksh gives "x is: hellothere, y is: hellothere"
bash gives the same
...So it doesn't work. If I assume the variable substitution is a pattern instead, that is I assume y=${x%..*} means "y equals x but remove a literal dot followed by a literal dot followed by anything (or nothing)", then let me change x to be something that such a pattern should match:
In this case, y should be "front". The results are:
sh I won't even try
ksh gives "x is: front..hellothere, y is: front"
bash gives "x is: front..hellothere, y is: front"
...That is, both ksh and bash work properly.
This shows that for Bourne shell, ksh88, and bash, this variable construct uses pattern matching, not regular expressions.
Hi.
How do I achieve this
sh /EDWH-DMT02/script/MISC/exec_sql.sh "@/EDWH-DMT02/script/others/CSM_CKC/Complete_List.sql ${file_name}" Complete_List.txt
The /EDWH-DMT02/script/MISC/exec_sql.sh has two parameters and it's working fine with this
sh /EDWH-DMT02/script/MISC/exec_sql.sh... (7 Replies)
I have a shell script (.sh) and I want to pass a parameter value to the awk command but I am getting exception, please assist.
diff=$1$2.diff
id=$2 new=new_$diff
echo "My id is $1"
echo "I want to sync for user account $id"
##awk command I am using is as below
cat $diff |... (1 Reply)
Discussion started by: Sarita Behera
1 Replies
3. Post Here to Contact Site Administrators and Moderators
Variable I have in my shell script
diff=$1$2.diff
id=$2
new=new_$diff
echo "My id is $1"
echo "I want to sync for user account $id"
##awk command I am using is as below
cat $diff | awk -F'~' ''$2 == "$id"' {print $0}' > $new
I could see value of $id is not passing to the awk... (0 Replies)
i am passing input parameter 'one_two' to the script , the script output should display the result as below
one_1two
one_2two
one_3two
if
then
echo " Usage : <$0> <DATABASE> "
exit 0
else
for DB in 1 2 3
do
DBname=`$DATABASE | awk -F "_" '{print $1_${DB}_$2}`
done
fi (5 Replies)
Hi,
I have this following code which gives me error when compiling. The problem is happening at the point where I create a const_iterator inside the overloaded insertion operator (i.e) operator << () function. The template argument version of set is not correct I guess. Could anyone please pitch... (3 Replies)
while i try to start the audit i have the below error message .
audit>audit start
** auditing enabled already
A system call received a parameter that is not valid.
please advice (6 Replies)
Hello everyone
suppose i have a script which can take any no. of parameters and in any order then how can i identify a particular parameter at which position it is entered
suppose
i call a script with four parameter
./abc.sh a b c d
in above calling
a is called at no. 1... (3 Replies)
Hi All,
I developed a KSH script which will accept two parameters as input. These two parameters are some directories paths.
In the script i am validating the number of paramaters it received as below
#--------------------------------------
# Check Command line arguments... (8 Replies)