unix command execution issue
Moderators: chulett, rschirm, roy
unix command execution issue
Hi,
I have an unix command its executinf fine in unix editor but when i tried to execute same command in datastage through execute command activity its throwing below warning
SH: -c: line 0: unexpected token 281 in conditional command
SH: -c: line 0: expected `)'
SH: -c: line 0: syntax error near `(28801>'
SH: -c: line 0: `if [[ $(ls -tr /etl/dev/target_files/work_files/spd_pyxis_adm/touch_files | wc -l) > 3 ]];then if [[ (T != "S") && (28801>=28800) && (28800<=72000)]];then echo "Source File Is Not Available " | mail -s "Hourly load job seq_Hourly_SPD_PYXIS_ADM:" XXX@yyy.com -r yyy@fff.com; fi;fi;'
provide some suggestions ..
I have an unix command its executinf fine in unix editor but when i tried to execute same command in datastage through execute command activity its throwing below warning
SH: -c: line 0: unexpected token 281 in conditional command
SH: -c: line 0: expected `)'
SH: -c: line 0: syntax error near `(28801>'
SH: -c: line 0: `if [[ $(ls -tr /etl/dev/target_files/work_files/spd_pyxis_adm/touch_files | wc -l) > 3 ]];then if [[ (T != "S") && (28801>=28800) && (28800<=72000)]];then echo "Source File Is Not Available " | mail -s "Hourly load job seq_Hourly_SPD_PYXIS_ADM:" XXX@yyy.com -r yyy@fff.com; fi;fi;'
provide some suggestions ..
D.N .MURTHY
-
- Premium Member
- Posts: 16
- Joined: Thu Jan 12, 2012 2:10 am
- Location: India
Hi,
Please look at this below unix command "
if [[ (28800<=72000) ]];then echo "Source File Is Not Available " | mail -s "Hourly load job seq_Hourly_SPD_PYXIS_ADM:" xxx@yyy.com -r dsadmd@yyy.com; fi;"
this command executing fine in unix environment , but when i tried to execute it through datastage in execute comand activity its saying below warnings .
SH: -c: line 0: unexpected token 281 in conditional command
SH: -c: line 0: expected `)'
SH: -c: line 0: syntax error near `(28800<'
SH: -c: line 0: `if [[ (28800<=72000) ]];then echo "Source File Is Not Available " | mail -s "Hourly load job seq_Hourly_SPD_PYXIS_ADM:" xxx@yyy.com -r dsadmd@yyy.com; fi;'
Please look at this below unix command "
if [[ (28800<=72000) ]];then echo "Source File Is Not Available " | mail -s "Hourly load job seq_Hourly_SPD_PYXIS_ADM:" xxx@yyy.com -r dsadmd@yyy.com; fi;"
this command executing fine in unix environment , but when i tried to execute it through datastage in execute comand activity its saying below warnings .
SH: -c: line 0: unexpected token 281 in conditional command
SH: -c: line 0: expected `)'
SH: -c: line 0: syntax error near `(28800<'
SH: -c: line 0: `if [[ (28800<=72000) ]];then echo "Source File Is Not Available " | mail -s "Hourly load job seq_Hourly_SPD_PYXIS_ADM:" xxx@yyy.com -r dsadmd@yyy.com; fi;'
Dream...Dare...Do
I thibnk:
SH: -c: line 0: syntax error near `(28801>'
is a clue. Looks like you need a space between the variable that is reprresented by 28801 and the >.
and Craig's suggestion is valid, DS executes basic sh commands and a lot of 'nix's don't . Most are either bash or ksh and you need to specify them to get things to work.
It it is working in the command line, find what shell you are executing and prefix the command there.
SH: -c: line 0: syntax error near `(28801>'
is a clue. Looks like you need a space between the variable that is reprresented by 28801 and the >.
and Craig's suggestion is valid, DS executes basic sh commands and a lot of 'nix's don't . Most are either bash or ksh and you need to specify them to get things to work.
It it is working in the command line, find what shell you are executing and prefix the command there.
Last edited by aartlett on Tue Mar 20, 2012 7:00 pm, edited 1 time in total.
Andrew
Think outside the Datastage you work in.
There is no True Way, but there are true ways.
Think outside the Datastage you work in.
There is no True Way, but there are true ways.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Issue aside, is the following
going to give what you want? You are only ever going to get one "/etl/dev/target_files/work_files/spd_pyxis_adm/touch_files" file back from the ls so would imagine "wc -l" will only ever give 1.
Should it be "touch_files*" or a wc on the content of "touch_files"?
Code: Select all
$(ls -tr /etl/dev/target_files/work_files/spd_pyxis_adm/touch_files | wc -l) > 3
Should it be "touch_files*" or a wc on the content of "touch_files"?