David PS

blog gallery projects

Get Bash!

08 Oct 2015 categories: week-ary   work   idl   shell  

This is a call to all solar physicists* that are using csh or any variant of it (eg. tcsh). Stop damaging yourself! You maybe don’t even know why you are using it. Well, if you are a solar physicists most likely you are using it because solarsoft but I’m here to tell you how you can start using bash without giving up of your sswidl environment (yet)

* This guide can be applied to anyone, not just solar physicists and solarsoft, other astronomers using iraf or other researchers using some other code that needs of csh will be able to follow the steps below and changing accordingly to their needs

Step Numero 1 - Know which shell you are using

Some of you have set the tcsh by default, others just get into it to run sswidl. To know in which shell you are in you can just do:

$ echo $0
tcsh

If you get such output then here’s where a new life for your shell experience will start.

Step 2 - Make bash your default

This depends how is your system configured. Normally, if it’s your own machine, then you could do:

$ chsh -s /bin/bash

Opening a new shell and trying step 1 should show whether it works. There are other options which you won’t need it. In the case the system is administrated by an IT team, then you should ask them to do it for you.

Step 3 - Solarsoft working from bash

Till today, probably you have a .cshrc file full of your configuration variables for solarsoft. From now on, you can keep your solarsoft configuration in an independent file. Let’s first create that file in a place where your PATH sees it. You don’t know what PATH means? Then do not worry, we can then create a new directory:

$ mkdir -p ~/Documents/bin

and add it to your PATH

$ echo "PATH=~/Documents/bin:+\$PATH" >> ~/.profile

Now we are going to create a new file in such directory called ssw, use your favourite editor to do such:

$ emacs ~/Documents/bin/ssw
#!/bin/csh
setenv IDL_DIR       /usr/local                   # Change this to where you have your IDL 
setenv IDL_TMPDIR    /unsafe/$user/ssw_tmp/       # Change this to your IDL tempdir
setenv SSW           /soft/soft2/solarsoft-OSF1/  # Change to where is your ssw (eg. $HOME/ssw )

# List of instruments to load for your solarsoft
setenv SSW_INSTR     "gen aia ontology xrt cds eit stereo secchi sxt eis"

source $SSW/gen/setup/setup.ssw /quiet

setenv IDL_PATH "<IDL_DEFAULT>"
setenv IDL_PATH "$HOME/Documents/path/to/your/library:"$IDL_PATH

if (! -d $IDL_TMPDIR ) then
    mkdir -p $IDL_TMPDIR
endif

# Run SSWIDL
sswidl

Note: the file as it is should work if you are at MSSL

Now, save it and let’s give it permissions to execute:

$ chmod u+x ~/Documents/bin/ssw

Done!

Open a new session and check whether it works:

$ ssw

Now you have an awesome shell and could do very cool stuff and run solarsoft from it.

Do you want an awesome idl shell? keep tuned! I’ll tell you how to use rIDL soon, but that will require a chocolate fee. :)

Enjoy!