Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

It can also be given a script containing any number of commands that will be executed sequentially.

Exercises


Exercise - create a delegate and check that pshell is using it.


Expand
titleSolution 1

pshell

login

sean

????

delegate

exit

pshell whoami


Exercise - script a task to download a file in your directory.

Expand
titleSolution 2

pshell -i script1.txt


With the plain text file script1.txt created containing:

Code Block
cd Demo/sean
get testfile1


Exercise - bash script a task that attempts to perform something illegal (eg remove directory www) and correctly report that the script encountered an error

Expand
titleSolution 3


Run the following script if you have bash ... sorry Windows users.


Code Block
#!/bin/bash

pshell "rmdir /idontexist"
if [$? -ne 0]
   echo "Operation failed!"
else
   eco "All good - proceed further!"


This would typically be a job script on (eg) Pawsey HPC - where you would be doing all such work in a Linux environment.

The idea is that if something in your data setup pipeline fails - don't waste any valuable cpu time on it.