if [ [ -n `grep ${TARGET_PATH_OK} ${PREPAVAL_TRAVAIL}/${EDI_DIRS_list}` ] && [ -d `grep ${TARGET_PATH_OK} ${PREPAVAL_TRAVAIL}/${EDI_DIRS_list}` ] ]
then
+ [ -n
./prepaval.ksh[2578]: test: ] missing
Thanks in advance
if [ [ -n `grep ${TARGET_PATH_OK} ${PREPAVAL_TRAVAIL}/${EDI_DIRS_list}` ] && [ -d `grep ${TARGET_PATH_OK} ${PREPAVAL_TRAVAIL}/${EDI_DIRS_list}` ] ]
then
+ [ -n
./prepaval.ksh[2578]: test: ] missing
Thanks in advance
Hi try
if [[ -n `grep ${TARGET_PATH_OK} ${PREPAVAL_TRAVAIL}/${EDI_DIRS_list}` ]] && [[ -d `grep ${TARGET_PATH_OK} ${PREPAVAL_TRAVAIL}/${EDI_DIRS_list}` ]]
There should be no spaces between the square brackets.
Regards
Dave
Or remove the outer brackets..
But can you suggest me solution to avoid empty condition because of grep.
In conditio, I am finding a value in a list. If it is found then condition complete if it is not found then condition is incomplete, for which error thows.
test: argument expected
Try putting double quotes around the back ticks...
-or alternatively make use of grep's return code, perhaps this will also server your purpose-
if grep -Fq "${TARGET_PATH_OK}" "${PREPAVAL_TRAVAIL}/${EDI_DIRS_list}" && [ -d "${TARGET_PATH_OK}" ]
Thanks for you suggestion, it worked
Now what is wrong with this:
if [ "${FXML_line:1129:1}" = "S" -o "${FXML_line:1129:1}" = "H" ]
Error:
[2586]: "${FXML_line:1129:1}": bad substitution
I am guessing your shell does not support this. You would need bash or ksh93.
If it didn't then it shouldn't have worked from test file...!
How were you calling the script? You should call it as ./script
bash ./script
and not as sh ./script
. Is there a shebang on the first line of the script?