top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

unix commands in Informatica command task - what am I missing?

0 votes
415 views

I tried a simple

if [ 1 == 1 ]; then echo "Hi"; fi >>/projects/ods/Chk.txt
included in the command task but it fails with error code 512....

what am I missing here?

posted Aug 21, 2014 by Sachin

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

An if/fi block cannot redirect output.

use

if [ 1 == 1 ]; then echo "Hi">>/projects/ods/Chk.txt; fi
As you indicate this is a simple test case, if you need output from a larger block of if/the/else/fi or other logic, you can wrap it all in a process group and redirect that output..

{
   if [ 1 == 1 ]; then 
     echo "Hi"
   else
     echo "nope" 
   fi 
} >>/projects/ods/Chk.txt

Also, it's likely that using == is a problem. Typically you'd use 1 -eq 1 or other constructs like if true ; then, or if you really want good math comparisons, use if (( 1 == 1 )) ; then ..., but older shells may or may not support the (( ... )) test.

answer Aug 25, 2014 by Shweta Singh
Similar Questions
+1 vote

My script ran successfully in Unix but not in a command task of an Informatica workflow. The permissions are fine, and the parameter file and variables have been declared in the workflow. Why is this happening?

+1 vote

I'm trying to get my Informatica workflow to fail a session if it selected 0 source records. I have come up with the following script to run as the Post-Session Success Command:

if [ $PM{Source Qualifier Name}@numAppliedRows == 0 ]
then
exit 2
else
exit 0
fi

where {Source Qualifier Name} is the name of my source qualifier. When I look at the session log it looks as I would expect where the $PM{Source Qualifier Name}@numAppliedRows is replaced by the number of rows my source qualifier selected but it is still causing the session to fail even when this number is != 0. The session log gives me the following error message:

sh: 0403-057 Syntax error at line 1 : 'if' is not matched.

Any help would be appreciated.

+1 vote

My source having 10 records but how can i load 20 records in target, i am not bother about duplicates. How I can do it?

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...