0

I have 2 questions about path.

first question is related to 'qsub'

this is my current folder

/home/mtrnn/rnn_class_EE837/src/rnn-learn/result/lissa_1_rec/

in this folder I use

qsub -q public_~~~ ./start.sh

It works well. The problem is whenever I use server, I need to change path in below shell script(start.sh) When I use in different folder, everytime I need to change below code in the start.sh

cd current_path

for example,

cd /home/mtrnn/rnn_class_EE837/src/rnn-learn/result/lissa_1_rec/

It's too bothering thing and it makes path error very often.

Can I delete

cd ~~~~ 

by using 'pwd' or something?

I mean, read current path using 'pwd' and put this result into shell script as a variable. Is is possible? I think, if I can get the result of 'pwd' as a variable and putting it as a variable of start.sh, I can remove that part. But, I don't how to do it.

This is start.sh

#!/bin/sh

cd /home/mtrnn/rnn_class_EE837/src/rnn-learn/result/lissa_1_rec/

   if [ "$1" = clean ]; then
   rm -f *.log *.dat target.txt *.scale *.restore
   exit
fi

config_file=test_config.txt
connection_file=connection.txt
if [ -f $connection_file ]; then
    cp $config_file ."$config_file".tmp
    gen_config.sh $connection_file >> ."$config_file".tmp
else
    cp $config_file ."$config_file".tmp
fi

../../rnn-learn -i rnn.dat -c ."$config_file".tmp ./target*.txt

#${path2}rnn-generate -n 2000 rnn.dat > orbit.log

rm ."$config_file".tmp

second question is,

#${path2}rnn-generate -n 2000 rnn.dat > orbit.log

in above code, there is ${path2}

I think for start.sh, ${path2} always pointing the folder that rnn-generate is located.

How can I do? If I can know the method, I want to change

../../rnn-learn -i rnn.dat -c ."$config_file".tmp ./target*.txt

to

${path3}rnn-learn ~~~

Ah, now I'm using server and I'm not ministrator.

So, I think , I can't change /etc/bashrc or /etc/environment.

Thank you.

user2268721
  • 175
  • 1
  • 13
  • Is this the [`qsub`](http://linux.die.net/man/1/qsub) that you're asking about? Aka POSIX [`qsub`](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/qsub.html)? – Jonathan Leffler Apr 11 '13 at 04:48
  • I don't know much about Aka POSIX. What I know about posix is, it means portable operating system. I use qsub to use parallel computation. for example, qsub -q public_8core start.sh – user2268721 Apr 11 '13 at 08:08
  • I work with torque extensively, but I don't totally understand the question, namely what you are describing in ~~~. Maybe you are looking for pbs directives? Take a look at PBS_O_WORKDIR. http://docs.adaptivecomputing.com/torque/help.htm#topics/2-jobs/exportedBatchEnvVar.htm?Highlight=variables – spuder Jun 03 '13 at 04:04

1 Answers1

0

qsub -cwd "command" runs the command from the same working directory it was launched from.

Assuming the mapping layers are setup correctly

Morgan
  • 19,934
  • 8
  • 58
  • 84