10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
#!/bin/bash
a1="04:29:39 - System health check failed"
i=$1
echo "a $((a$i))"
The script above gives the following error
$113> sh tryt.sh 1
tryt.sh: line 6: 04:29:39 - System health check failed: syntax error in expression (error token is ":29:39 - System health check failed")
It... (1 Reply)
Discussion started by: ashima jain
1 Replies
2. UNIX for Advanced & Expert Users
Hello All,
I'm trying to extract the lines between two consecutive elements of an array from a file.
My array looks like:
problem_arr=(PRS111 PRS213 PRS234)
j=0
while } ]
do
k=`expr $j + 1`
sed -n "/${problem_arr}/,/${problem_arr}/p" problemid.txt
---some operation goes... (11 Replies)
Discussion started by: InduInduIndu
11 Replies
3. Shell Programming and Scripting
I'm pretty new to shell scripting, but I am catching on quick. I did see one of the stickied threads about the csh, and I think this is relevant, but I don't understand enough to make a decision based on it. So as you'll see below, I use the |csh pipe, and if that is not correct, I'm certainly... (2 Replies)
Discussion started by: macman104
2 Replies
4. Shell Programming and Scripting
root@server01 # df -h | grep /tmp | awk {'print $3}'
252M
root@server01 #
root@server01 # cat /usr/local/tmpchk.sh
#!/bin/sh
x=`df -h | grep /tmp | awk {'print $3}'`
if ;
then
rm -fr /tmp/somefolder/
else
echo "its small" (2 Replies)
Discussion started by: fed.linuxgossip
2 Replies
5. Shell Programming and Scripting
#! /bin/csh
set umr=UMR
foreach i ( `ls`)
set file_nm=$i
set bh_nm=`echo $file_nm | cut -d"_" -f2`
if($bh_nm !=$umr) then
{
set bh_ext=`echo $file_nm | cut -d"_" -f4`
set bh_num_nm="$bh_nm $bh_ext a .txt"
mv $file_nm $bh_num_nm
}
... (1 Reply)
Discussion started by: jdsignature88
1 Replies
6. Shell Programming and Scripting
Hi All,
am trying to add two Inputs i.e., $1 and $2,
Code
#!/bin/sh
$num_sum=`expr $1+$2`
echo "Sum = $num_sum"
am giving statement sh arithemetic.sh 20 10
am getting error
arithemetic.sh: line 2: =20+10: command not found
Sum =
I want Output as
Sum = 30, (5 Replies)
Discussion started by: sunnix
5 Replies
7. Shell Programming and Scripting
HI again, still working on the assignment, which is really hard given we just started unix 4 weeks ago. This script should change the permission for the user depending if its x, w or r, to the opposite. When i try to run it, I am getting expression error. Can you spot where the problem is? I really... (3 Replies)
Discussion started by: morava
3 Replies
8. Shell Programming and Scripting
I'm a beginner so I might make beginner mistakes.
I want to count the "#define" directives in every .C file
I get the following errors:
./lab1.sh: line 5: ndef: command not found
./lab1.sh: line 6:
#!/bin/sh
for x in *.
do
ndef = 'grep -c \#define $x'
if ; then
... (2 Replies)
Discussion started by: dark_knight
2 Replies
9. UNIX for Advanced & Expert Users
I have a file "fwcsales_filenames.txt" which has a list of file names that are supposed to be copied to another directory. In addition to that, I am trying to extract the date part and write to the log.
I am getting the regular expression error when trying to strip the date part using the "ll"... (1 Reply)
Discussion started by: madhunk
1 Replies
10. Programming
I had seen this error for the first time .....
error: initializer expression list treated as compound expression
please help.... (12 Replies)
Discussion started by: arunchaudhary19
12 Replies