User Tools

Site Tools


linux:scripts:basics

Script

Commands

Command Function
#!/bin/bash
or
#!/bin/sh
shebang
VAR=var set VAR to var
$VAR inserts var whereever $VAR is placed
case - esac inserts case
if [ “var” == “var” ]; then fi inserts if

Troubleshooting

Interpreter error

Problem:

Running your script prompts interpreter error

Fix:

Open your script with vi and execute the following

 :set fileformat=unix 

Not enough rights

Problem:

Running your script requires more rights

Fix:

Make your script executable with the following command

chmod +x [scriptname].sh



linux/scripts/basics.txt · Last modified: 2018/12/20 17:44 by lunetikk