#How to create executeable script?

10 messages · Page 1 of 1 (latest)

crystal crest
#

How to create executeable script?

wind burrow
# crystal crest How to create executeable script?

Just just create a file.
For example with touch test.sh
touch will create a (empty) file if it doesn't exist by default.

Write your code with your favorite editor like nano

Then make sure to set the executable flag on it with chmod u+x <file name>
That will give the [u]ser who owns the file the right to e[x]ecute it.

crystal crest
#

Um sorry if my engglish bad

wind burrow
steel juniper
#

you can also use echo to write to files
example: echo "echo HELLO THERE!!" >> file.sh

viscid bison
#

there's cat tho

cat > file.sh << EOF
#!/usr/bin/env bash

echo "Hello World using *cat*"
EOF
wind burrow
#

HEREDOCS are kind of clumsy for simple appending from the command line.

viscid bison
#

yep, i know

#

u can use echo for appending, cat for rewriting