Forum Discussion

bsb's avatar
bsb
Icon for Nimbostratus rankNimbostratus
Jun 12, 2018

batch file

Hi, have couple of commands to fetch configuration files, statistical data etc...over cli, need to run it as a batch script. have saved it as test.sh file and unable to run it via cli. is there any other format to be used, if so please let me know what format to save and how to run it.

 

1 Reply

  • I sure you mean bash script.

    Make sure you have this line at the beginning:

    !/bin/bash

    Also, make sure the file has permission to run:

    chmod +x filename

    Last make sure the file is formatted for Unix. See the explanation here:

    https://en.wikipedia.org/wiki/Unix2dos

    You can download the software here, including a version for windows.

    https://waterlan.home.xs4all.nl/dos2unix.html

    Also, most text editors, like notepad++, have a function to do that.

    If you still can't run the script. Paste here the command you are using to run it, and also the output you get when you try to run.