It's all about the answers!

Ask a question

Buildforge: step can not be safed when using special characters


Christian May (1123) | asked Dec 11 '12, 8:53 a.m.
edited Dec 11 '12, 8:55 a.m.
The following pretty simple step can not be safed:

  step

Also, masking the special characters with a backslash (\) is not helping.

I'm using bfproject 7.1.2.0-0-0341.

Any ideas?

Christian

3 answers



permanent link
Spencer Murata (2.3k115971) | answered Dec 11 '12, 9:56 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
 I'm not exactly sure what you are doing or what you are seeing, but for variable expansion problems remember that the command will be parsed TWICE.  Build Forge will take a pass at variable expansion and will attempt to expand variables for its own environment, and then the shell will take a variable expansion pass.  If the shell starts another shell it will possibly take more variable expansion passes.  To bypass the BF variable expansion try  _NO_PREPARSE_COMMAND in the step.  Otherwise double up any variable characters.

permanent link
Christian May (1123) | answered Dec 11 '12, 10:19 a.m.
Hi Spencer, thanks for your quick response. Actually, all I want to do is call a Linux command (ls -asl) and modify the output by using awk. The command on my host system will show the following:

[root@jabulan-lp4 ~]# ls -asl | awk '{ print $5 }'

root
root
root
root
root
root
root
root
users

When trying to put this Linux command into the buildforge step, I can not save the step... It seems to be related to the awk part because the simple "ls -asl" is working. I'm trying to mask the '{ print $5 }'- expression like \'{ print $5 }\'  but this is not helping...


Comments
Spencer Murata commented Dec 11 '12, 10:51 a.m. | edited Dec 11 '12, 10:51 a.m.
FORUM MODERATOR / JAZZ DEVELOPER

Ok the answer then is the same.  The problem is the $5 will be interpreted to 5 by BF, so either use the preparse on the step or double up the $ character.


ls -asl | awk '{ print $$5 }' 


permanent link
Christian May (1123) | answered Dec 11 '12, 11:02 a.m.
I've changed the environments to



and changed the environment in my library..not helping.

I've changed the masking..not helping...

After changing the command in the step and saveing the step, I would like to start the library but then I'm getting this message:




Strange...

Comments
Spencer Murata commented Dec 11 '12, 11:19 a.m.
FORUM MODERATOR / JAZZ DEVELOPER

What exactly do you see in the step log when you escape the $5?


Christian May commented Dec 11 '12, 11:27 a.m. | edited Dec 11 '12, 11:28 a.m.

I can not run this modified step because I can not save it - I need to usue the ^for escaping. And not only the $ is the problem, the ' are causing trouble too. I can escape them using ^ but then the awk expression was producing an error:

184 12/11/12 10:30 AM       ENV BF_USER_LOGIN=root
185 12/11/12 10:30 AM       ENV BF_W=2
186 12/11/12 10:30 AM       ENV LANG=C
187 12/11/12 10:30 AM       ENV REMOTE_HOST=::ffff:9.27.29.43
188 12/11/12 10:30 AM       ENV _NO_PREPARSE_COMMAND=1
189 12/11/12 10:30 AM       EXEC    spawning shell [/bin/bash]
190 12/11/12 10:30 AM       SCRIPT  lsscsi | awk ^'{ print $$4 }^'
191 12/11/12 10:30 AM       EXEC    start [/tmp/lsscsi/BUILD_10@jabulan-lp4.austin.ibm.com]
192 12/11/12 10:30 AM       EXEC    awk: ^{ print $$4 }^
193 12/11/12 10:30 AM       EXEC    awk: ^ syntax error
194 12/11/12 10:30 AM       EXEC    end [/tmp/lsscsi/BUILD_10@jabulan-lp4.austin.ibm.com]
195 12/11/12 10:30 AM       RESULT  1 (1)

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.