I have tried to make a bash script.vi hello_worldInside the script i have written#!/bin/bashtext=Hello Worldecho $textWhen i type in echo $hello_worldShouldn't the script be run then i print out Hello World ? Or is something wrong in the syntax?
Bash scripts - Why isn't echo executing?
shell script;ubuntu
You use the wrong syntax to call the script.echo $hello_worldprints the contents of the variable hello_world.You need to type the path to the script to execute the shell script hello_world:./hello_worldThis executes hello_world if it is in the current working directory.To run the script directly (ie with ./script), you need to make the it executable. You can do this with:chmod +x ./hello_worldor by using the file properties dialog of your file manager.