2
I want to change working directory of my script by another script that has been included.
First script:
#!/bin/bash
pwd
source script2
pwd
Sedond script:
cd ..
pwd
The result is following:
> ./script1
/home/sebi/testdir1/testdir2 # 1st script
/home/sebi/testdir1 # 2nd script
/home/sebi/testdir1 # 1st script
I have edited the question as I tested this script and it worked as I wanted however following script works differently, as subscript finishes execution parent is in same directory as it was before invocation of the subscript.
#!/bin/bash
while :
do
sleep 5
cat /home/.../shelldata.txt >> /home/.../gmodshell #logging
((source /home/..../shelldata.txt) 2>&1) | \
sed -e "s/..shellRunner.sh..line../SH/" > \
/home/..../shellFeedback.txt
echo > /home/..../shelldata.txt
done
Whole aim is to access bash using files so I can write command to one file and after a while I get output in other file.
1It works fine for me if I do the exact same thing. – Sebastian Paaske Tørholm – 2011-06-08T12:37:56.077