Sponsored Content
Top Forums Shell Programming and Scripting Observing error :syntax error in expression Post 302967851 by ashima jain on Monday 29th of February 2016 08:46:18 AM
Old 02-29-2016
Observing error :syntax error in expression

Code:
#!/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 also fails when I try to compare in if condition. How to compare a$i to a value in if condition. My purpose is to display the statement.
Can someone explain?
 

10 More Discussions You Might Find Interesting

1. Programming

error: initializer expression list treated as compound expression

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

2. UNIX for Dummies Questions & Answers

awk Shell Script error : "Syntax Error : `Split' unexpected

hi there i write one awk script file in shell programing the code is related to dd/mm/yy to month, day year format but i get an error please can anybody help me out in this problem ?????? i give my code here including error awk ` # date-month -- convert mm/dd/yy to month day,... (2 Replies)
Discussion started by: Herry
2 Replies

3. AIX

nim mksysb error :/usr/bin/savevg[33]: 1016,07: syntax error

-------------------------------------------------------------------------------- Hello, help me please. I am trying to create a mksysb bakup using nim. I am geting this error, how to correct it ? : Command : failed stdout: yes stderr: no... (9 Replies)
Discussion started by: astjen
9 Replies

4. Shell Programming and Scripting

One more expression syntax error

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

5. Shell Programming and Scripting

syntax error for if statment test expression

Hi what's the correct way of writing if 1)if "$time_diff" -gt 5 then echo "killing hung process \n" fi 2)if test $time_diff -gt 5 then echo "killing hung process \n" fi where -time_diff=$(($Sam - $current_min)) and current_min=`date +%M` infact both are giving Syntax... (1 Reply)
Discussion started by: Anteus
1 Replies

6. Shell Programming and Scripting

if expression syntax error

#! /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

7. Shell Programming and Scripting

if: expression syntax error in gawk

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

8. Shell Programming and Scripting

Help with awk script (syntax error in regular expression)

I've found this script which seems very promising to solve my issue: To search and replace many different database passwords in many different (.php, .pl, .cgi, etc.) files across my filesystem. The passwords may or may not be contained within quotes, single quotes, etc. #!/bin/bash... (4 Replies)
Discussion started by: spacegoose
4 Replies

9. Shell Programming and Scripting

TCL: syntax error in expression with "*"

I'm using tcl scripts in ns2 ( network simulator) through cygwin. It works fine , however, I downloaded an example when i run it , I got the following syntax error: syntax error in expression with " *2" : unexpected operator * while executing : "expr $bw *2" invoked from within: "$ns... (1 Reply)
Discussion started by: ENG_MOHD
1 Replies

10. Shell Programming and Scripting

IF section problem. syntax error: unexpected end of file error

Hello, I have another problem with my script. Please accept my apologies, but I am really nooby in sh scripts. I am writing it for first time. My script: returned=`tail -50 SapLogs.log | grep -i "Error"` echo $returned if ; then echo "There is no errors in the logs" fi And after... (10 Replies)
Discussion started by: jedzio
10 Replies
MPT-STATUS(8)						      System Manager's Manual						     MPT-STATUS(8)

NAME
mpt-status - retrieve configuration and health status from LSI hardware RAID controllers SYNOPSIS
mpt-status [ options ] DESCRIPTION
The mpt-status software is a query tool to access the running configuration and status of LSI SCSI HBAs. mpt-status allows you to monitor the health and status of your RAID setup. OPTIONS
--autoload This will try to automatically load the mptctl kernel module. -u --controller <int> Set the IOC unit (controller). -h --help Print some help information. -n --newstyle Use the new style output. This parameter was introduced to retain backwards compatibility. If not set, you get the old style output. It is very likely that the output of the newstyle format will change heavily in the future, so do not rely on it when writing plug- ins for monitoring software, for example. -i --set_id <int> Set id of primary device (check README). -p --probe_id Use this to probe SCSI id's when not on id 0. -q --quiet Do not display any warnings. -s --status_only Only print the status information. This can be used for easy scripting -v --verbose Print verbose information, such as warnings -V --version Print version information -d --debug [<int>] Enable debugging and set level optionally. NOTE: This is not fully implemented yet. DIAGNOSTICS
The program's exit(2) status is meant to be interpreted as a bit mask. If everything went well, zero is returned. If not (i.e. if for exam- ple an error or unknown condition is detected), the bits of the return value shall be interpreted as: Bit Value Meaning ----------------------------------------------------------------- 0 1 Abnormal condition / unknown error 1 2 A logical volume has failed 2 4 A logical volume is degraded 3 8 A logical volume is resyncing 4 16 At least one physical disk failed 5 32 At least one physical disk is in warning condition REPORTING BUGS
Report bugs to your linux distribution or software vendor, if mpt-status was bundled on your installation. If you have been compiling mpt- status from the vanilla sources and experience problems, redirect them to preferably <ratz@drugphish.ch> or <rnibali@pyx.ch>. BUGS
Besides design bugs, gross software engineering and missing features, this software is considered pretty stable and can be used in produc- tion environments. FILES
/dev/mptctl SEE ALSO
LSI Logic provides CLI tools for megaraid controllers which you can find on their webpage, following http://www.lsil.com/cm/Download- Search.do AUTHOR
mpt-status was written by Roberto Nibali <ratz@drugphish.ch>. This manual page was written by Steffen Joeris <steffen.joeris@skolelinux.de>, for the Debian project (but may be used by others). November 2006 MPT-STATUS(8)
All times are GMT -4. The time now is 12:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy