LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Run commands from a new terminal in a script (https://www.linuxquestions.org/questions/linux-newbie-8/run-commands-from-a-new-terminal-in-a-script-4175499794/)

shubham.joy 03-28-2014 09:30 AM

Run commands from a new terminal in a script
 
Hi,
My default shell is csh. I have a script that runs correctly on a bash which I want to add to cronjob. How do I make all the commands in the script run on bash.

Currently the cronjob tries to execute the script on csh and reports error.

I tried first first command as bash, and then the rest of the commands. But bash runs and the rest of the commands run on csh.

Following is the script:
Code:

cd /auto/nobackup-bgl-mitg-dev10/shubhaja/
dir_name=latest
#dir_name="$(date +'%d%b').v160.main"
rm -rf $dir_name
mkdir $dir_name
cd $dir_name
git-ws --branch v160.main asr5k/master master    //This works on bash only
cd master
fetch boxer
assemble


Ser Olmy 03-28-2014 09:40 AM

A script should start with a "shebang" comment specifying the required shell. Use this as the very first line of the script:
Code:

#!/bin/bash

shubham.joy 03-30-2014 11:52 PM

Still not working. Added the above line.
The script works fine if I execute it from bash by command ./script.txt.

I get errors if I execute it from the default csh shell, even after adding the comment line as the first line.

Quote:

Originally Posted by Ser Olmy (Post 5142867)
A script should start with a "shebang" comment specifying the required shell. Use this as the very first line of the script:
Code:

#!/bin/bash


kirukan 03-31-2014 12:44 AM

Add this in your beginning of the script.
Quote:

#!/bin/csh


All times are GMT -5. The time now is 01:26 AM.