Writing Script

From DeepSense Docs
Revision as of 20:18, 3 December 2020 by Bgeetika (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Bash scripts are used to put multiple commands in one place that you run on the command line. Anything you put into bash scripts will work exactly the same as they work on the command line. Bash is available by default on Linux and macOS operating systems, however, for windows, you can install Git Bash to work with bash scripts. For creating the bash scripts, save the file with the .sh extension. To run this bash script, use the keyword bash followed by the name of the file

For example : if the File Name is example.sh, run this file by writing “bash example.sh” 

Writing Bash scripts

In bash scripts, you can put all the commands which you feel are required to run every time when you start your project such as activate Conda environment, Job submission, open Jupyter Notebook, etc.. This will save your time. Below is the example of bash script with name "example.sh"

For example:

example.sh

#!/bin/bash
source /opt/anaconda2/etc/profile.d/conda.sh
conda activate
bsub -Is -gpu - bash
jupyter notebook --no-browser --ip=0.0.0.0


The above script will execute all the commands in bash shell.