It's all about the answers!

Ask a question

rm /etc/profile: line 33: id: command not found


Jirong Hu (1.5k9295258) | asked Aug 28 '12, 3:19 p.m.
Why can't run simple command like pwd and rm, but unzip works?



 1 08/28/12 03:09PM STEP Step using selector 'rfksappd02_c999752'.
134	08/28/12 03:09PM	EXEC	Locale set to 'C'
135	08/28/12 03:09PM	PTY	allocated pseudo-tty pipe
255	08/28/12 03:09PM	EXEC	Performing variable expansion on command line
256	08/28/12 03:09PM	EXEC	spawning shell [/bin/bash]
257	08/28/12 03:09PM	SCRIPT	pwd
258	08/28/12 03:09PM	SCRIPT	rm -Rf bldforge_AOMS_DEV
259	08/28/12 03:09PM	SCRIPT	rm AOM_Dev_Full_Build_r1.3.11_TxCX_120828135108_B494.zip
260	08/28/12 03:09PM	SCRIPT	unzip -o AOM_Dev_Full_Build_r1.3.11_TxCX_120828150815_B494.zip
261	08/28/12 03:09PM	EXEC	start [/home/c999752@rfksappd02]
262	08/28/12 03:09PM	EXEC	/etc/profile: line 33: id: command not found
263	08/28/12 03:09PM	EXEC	/etc/bashrc: line 8: id: command not found
264	08/28/12 03:09PM	EXEC	/etc/bashrc: line 8: id: command not found
265	08/28/12 03:09PM	EXEC	
266	08/28/12 03:09PM	EXEC	/home/c999752
267	08/28/12 03:09PM	EXEC	-bash: line 4: rm: command not found
268	08/28/12 03:09PM	EXEC	-bash: line 5: rm: command not found
269	08/28/12 03:09PM	EXEC	Archive:  AOM_Dev_Full_Build_r1.3.11_TxCX_120828150815_B494.zip
270	08/28/12 03:09PM	EXEC	  inflating: bldforge_AOMS_DEV/WebSphere_AVOB/AOMS_FDN/Foundation/extensions/global/entities/Extensions.xml  

Accepted answer


permanent link
Robert haig (1.0k16) | answered Aug 28 '12, 3:38 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
 Something is missing from your PATH env var.  You should see PATH listed in the ENV section of your step log.  usually it would look similar to this: /usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

Depending on your system, unzip, id, and rm may all be in different directories from mine.  I would suggest logging in from the command-line, find out where these commands are located (try "which rm" for instance to locate the rm command) and then look at the PATH variable to make sure all of the directories you need are in there.


Robert haig selected this answer as the correct answer

Comments
Jirong Hu commented Aug 28 '12, 3:45 p.m.

Right, I have PATH=Z:;PATH in the env. It was for Windows agents. I need to create a new environment for this server.


Jirong Hu commented Aug 28 '12, 4:44 p.m.

Sorry, I didn't finish reading your reply. My rm command is in /bin. It works after adding that to my PATH. Thanks.

4 other answers



permanent link
Jirong Hu (1.5k9295258) | answered Aug 28 '12, 4:39 p.m.
It's still not working. I set the PATH to the right one, as you can see I tried from unix command and it works.
252	08/28/12 04:35PM	ENV	LANG=C
253	08/28/12 04:35PM	ENV	PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb::/usr/bin/X11:/sbin:/opt/rational/clearcase/bin:/opt/rational/clearcase/etc/utils:.254	08/28/12 04:35PM	ENV	REMOTE_HOST=::ffff:10.1.131.23
	
255	08/28/12 04:35PM	EXEC	Performing variable expansion on command line
257	08/28/12 04:35PM	EXEC	spawning shell [/bin/bash]
258	08/28/12 04:35PM	SCRIPT	pwd
259	08/28/12 04:35PM	SCRIPT	rm -Rf bldforge_AOMS_DEV
260	08/28/12 04:35PM	SCRIPT	rm AOM_Dev_Full_Build_RETAGGING_16.zip
261	08/28/12 04:35PM	SCRIPT	unzip -o AOM_Dev_Full_Build_HPPC_BUILD_TAG.zip
262	08/28/12 04:35PM	EXEC	start [/home/c999752@rfksappd02.hbc.com]
263	08/28/12 04:35PM	EXEC	/home/c999752
264	08/28/12 04:35PM	EXEC	-bash: line 4: rm: command not found
265	08/28/12 04:35PM	EXEC	-bash: line 5: rm: command not found
	


[c999752@rfksappd02 ~]$ set PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb::/usr/bin/X11:/sbin:/opt/rational/clearcase/bin:/opt/rational/clearcase/etc/utils:.
[c999752@rfksappd02 ~]$ rm
rm: missing operand
Try `rm --help' for more information.
[c999752@rfksappd02 ~]$ echo $PATH
/usr/local/bin:/bin:/usr/bin:/home/c999752/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb::/usr/bin/X11:/sbin:/opt/rational/clearcase/bin:/opt/rational/clearcase/etc/utils:.:/home/c999752/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb::/usr/bin/X11:/sbin:/opt/r
[c999752@rfksappd02 ~]$ rm
rm: missing operand
Try `rm --help' for more information.
	


permanent link
Jirong Hu (1.5k9295258) | answered Aug 28 '12, 4:40 p.m.
 This is my step command:

.tset env "PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb::/usr/bin/X11:/sbin:/opt/rational/clearcase/bin:/opt/rational/clearcase/etc/utils:."
pwd
rm -Rf ${HPPC_DEV_VIEW}
rm ${BF_PROJECTNAME}_${BF_LASTTAG}.zip
unzip -o ${BF_PROJECTNAME}_${HPPC_BUILD_TAG}.zip

permanent link
Robert haig (1.0k16) | answered Aug 28 '12, 5:12 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
note that the :: and the . in your path are functionally equivalent. It is also not a good security best practice to have . or a null (::) in your path as someone could put a malicious program named "ls" in a directory and if you were in that directory when you executed "ls" it could compromise your account.


Comments
Jirong Hu commented Aug 29 '12, 3:35 p.m.

I tried the following: .tset env "PATH=$PATH", but the result is something like "PATH=Z:;PATH", which looks the PATH set in the project environment (Z:\;%PATH%) for the windows environment.

What I want is actually the current $path in the unix agent. How can I do that?


Robert haig commented Aug 29 '12, 3:52 p.m. | edited Aug 29 '12, 3:53 p.m.
FORUM MODERATOR / JAZZ DEVELOPER

set an env var named PATH in an environment group. apply that group to your unix server. in that group, set the value to be "PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb::/usr/bin/X11:/sbin:/opt/rational/clearcase/bin:/opt/rational/clearcase/etc/utils:."

you do not need to use .tset

alternatively you could set the path in your step using a shell command export PATH=/usr/local/bin:/usr/bin:/bin rm filename


permanent link
Robert haig (1.0k16) | answered Aug 29 '12, 3:53 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
 set an env var named PATH in an environment group.  apply that group to your unix server.  in that group, set the value to be "PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb::/usr/bin/X11:/sbin:/opt/rational/clearcase/bin:/opt/rational/clearcase/etc/utils:." 
<br><br>
you do not need to use .tset

alternatively you could set the path in your step using a shell command
  export PATH=/usr/local/bin:/usr/bin:/bin
  rm filename

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.