NERSCPowering Scientific Discovery Since 1974

HSI Shell Script

This example shows a script containing HSI actions. Note that in this case a single-line command is used so no "here-doc" is needed.  This simplifies the script and demonstrates some of HSI's advantages over pftp or ftp.  This script assumes that you have previously interactively logged into HSI at least once to encrypt your username/password.

#!/bin/csh
# First copy the data and program source from the submitting directory

hsi -h archive.nersc.gov "cd my_HPSS_directory; get data* source.f"

./myproj data outfile

# Save the output file in HPSS

hsi -h archive.nersc.gov "cd my_HPSS_directory; put outfile; put restart*"

exit

Note that in this example the individual hsi commands are separated by semicolons and the set of commands is contained in quotes.  The semicolons are necessary and are currently the only allowed command separator.  The quotes are required to prevent shell interpretation of wild card characters and are recommended for general safety in one-liners.  Note that the suppression of shell interpretation prevents the effective use of wildcard file and directory specifications in one-liners.

Unlike an interactive HSI session no termination command (i.e., exit, quit, etc.) is needed in a one-liner.

In addition to one-line commands HSI can also take input command sets from files.  For more information on this see the HSI documentation.