08-15-2019
Your script works flawlessly in
bash, so I presume you run it with
ksh.
man ksh:
Quote:
[[ expression ]]
Similar to the test and [ ... ] commands (described later), with the following exceptions:
.
.
.
o The single argument form of test, which tests if the argument has non-zero length, is not valid - explicit operators must be always be used, e.g., instead of [ str ] use [[ -n str ]]
BTW, what you are doing is a test for a non-zero string e.g. "/usr/bin/bash", not for the existence of a file or command... Why not test for "executable"?
This User Gave Thanks to RudiC For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello all,
I want to create a script that polls every hour a directory for the existence of a file. The file I look for is a `token` dropped by an external process at the completion of a successful FTP process. I wrote this script `checkfile.ksh`:
#!/usr/bin/ksh
if ] then
mailx... (5 Replies)
Discussion started by: alan
5 Replies
2. Shell Programming and Scripting
Hi,
i am getting following syntax error ...kingly advice why is it coming ??
#!/bin/bash
find . -name "common.log"
if ; then
echo "1"
fi
Himnashu@home /bin
$ ./a.sh
./a.sh: line 7: syntax error near unexpected token `fi'
./a.sh: line 7: `fi' (9 Replies)
Discussion started by: himvat
9 Replies
3. Shell Programming and Scripting
Guys ,
This is an output of my script errored out for "Syntax error near unexpected token `(' " Can someone tell me whats wrong with my script.
Below is my original script pasted.
#!/bin/bash
Script Creation Date 01/21/2010
Author baraghun
... (7 Replies)
Discussion started by: raghunsi
7 Replies
4. UNIX for Advanced & Expert Users
Hi,
I am running the following script through cygwin and getting below mentioned error.
*******************************************
#!/bin/sh
# constants
WORK_DIR="deploy"
INFOFILE="deploy.info"
INTROFILE="Intro.sh"
CMGMT_PKG="com.kintana.cmgmt.deploy"
DEPLOY_PREFIX="mitg"
... (2 Replies)
Discussion started by: MandyR
2 Replies
5. Shell Programming and Scripting
Hi all,
Am very new to Unix and am currently Involved in Migrating some Shell Scripts from AIX 4 to Solaris 10.
While using teh for loop am getting the below error:
$ echo $SHELL
/usr/bin/ksh
$ for file in $(ls *SEBE*)
syntax error: `$' unexpected
while the same works without issue on... (4 Replies)
Discussion started by: paragkhanore
4 Replies
6. Shell Programming and Scripting
I'm going mad not being able to get this to work. im assuming its only a simple mistake but its driving me bonkers trying to find it.
Please if you can help me it would save me pulling my hair out!!
Thanks
#!/bin/bash -xv
#
#Config
name="TEST Server"
+ name='TEST Server'... (6 Replies)
Discussion started by: Fisheh
6 Replies
7. Shell Programming and Scripting
Hi,
I am trying to read the session log through script. But it keeps showing me some error near. I have tried everything. Even tried converting the script using sed command to remove the hidden characters(\r).But nothing seems to be working.Below is the script :
#!/bin/bash
cd... (6 Replies)
Discussion started by: Aryan12345
6 Replies
8. Shell Programming and Scripting
unzip file.zip
if ] ; then
echo "Success"
else
echo "Some failure."
fi ;
I tried many time to detect the unzip error, but it keep show the syntax error wherever how I change the syntac. Hope someone can help me fix the issue, thanks.
Please use code tags next time for your code and... (5 Replies)
Discussion started by: duncanyy
5 Replies
9. Shell Programming and Scripting
I have written this in my script but while running i am getting syntax error `(' unexpected.
unload to "$BACKUP_DIR/n_fac_fid-$clliname" select * from n_fac_fid where fac_accesskey in (select fac_accesskey From n_fac_ap_fid where ap_clli="$clliname");
Any help appreciated. (3 Replies)
Discussion started by: suryanmi
3 Replies
10. UNIX for Beginners Questions & Answers
Dears,
While executing the below script im getting the error at line 30. Please let me know what changes to be done to fix this.
test.sh: line 30: syntax error near unexpected token `done'
test.sh: line 30: ` done '
#!/bin/sh
# Rev. PA1
# author: eillops
# date: 26-04-2018
#
#... (1 Reply)
Discussion started by: Kamesh G
1 Replies
LEARN ABOUT OSX
mpi_status_set_cancelled
MPI_Status_set_cancelled(3OpenMPI) MPI_Status_set_cancelled(3OpenMPI)
NAME
MPI_Status_set_cancelled - Sets status to indicate a request has been canceled.
SYNTAX
C Syntax
#include <mpi.h>
int MPI_Status_set_cancelled(MPI_Status *status, int flag)
Fortran Syntax
INCLUDE 'mpif.h'
MPI_STATUS_SET_CANCELLED(STATUS, FLAG, IERROR)
INTEGER STATUS(MPI_STATUS_SIZE), IERROR
LOGICAL FLAG
C++ Syntax
#include <mpi.h>
void MPI::Status::Set_cancelled(bool flag)
INPUT
/OUTPUT PARAMETER
status Status with which to associate cancel flag (status).
INPUT PARAMETER
flag If true, indicates request was canceled (logical).
OUTPUT PARAMETER
IERROR Fortran only: Error status (integer).
DESCRIPTION
If flag is set to true, then a subsequent call to MPI_Test_cancelled(status, flag) will also return flag = true; otherwise it will return
false.
NOTES
Users are advised not to reuse the status fields for values other than those for which they were intended. Doing so may lead to unexpected
results when using the status object. For example, calling MPI_Get_elements may cause an error if the value is out of range, or it may be
impossible to detect such an error. The extra_state argument provided with a generalized request can be used to return information that
does not logically belong in status. Furthermore, modifying the values in a status set internally by MPI, such as MPI_Recv, may lead to
unpredictable results and is strongly discouraged.
ERRORS
Almost all MPI routines return an error value; C routines as the value of the function and Fortran routines in the last argument. C++ func-
tions do not return errors. If the default error handler is set to MPI::ERRORS_THROW_EXCEPTIONS, then on error the C++ exception mechanism
will be used to throw an MPI:Exception object.
Before the error value is returned, the current MPI error handler is called. By default, this error handler aborts the MPI job, except for
I/O function errors. The error handler may be changed with MPI_Comm_set_errhandler; the predefined error handler MPI_ERRORS_RETURN may be
used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error.
Open MPI 1.2 September 2006 MPI_Status_set_cancelled(3OpenMPI)