Reputation: 121
I am trying to run a shell script on Jenkins and want to change the directory. My code is as follows :
#!/bin/bash
pwd
function myprog() {
cd root/data
}
myprog
pwd
I tried all possibilities mentioned in the question posted here.
I tried symbolic links, Alias and function, however no success. In the jenkins console output i always get the following error :
/tmp/hudson772738020072372550.sh: line 11: cd: root/data: No such file or directory
What i notice here is that, there is a colon after cd, is that creating some issue? Kindly help. Thanks.
Upvotes: 1
Views: 5823
Reputation: 8446
This is the shell's way of saying that the string root/data
does not correspond with any directory below the current directory.
You probably meant to say cd /root/data
instead.
Upvotes: 1