Reputation: 9
I'm trying to make the following snippet execute automatically. I have enabled permissions. I'm new to both Linux and shell scripting, and know very little about it. Here is the code I would like to execute:
raspivid -t -0 -w 1080 -h 720 -awb auto -fps 30 -rot 90 -b 1200000
-o -|ffmpeg -loglevel quiet -i - -vcodec copy -an -f flv
-metadata streamName=myStream tcp://0.0.0.0:6666&
It works fine when I paste it into the command line and press "enter". However, I need it to execute automatically, so I'm trying to write a script to do that. This is what I've tried to do in nano editor:
#!/bin/bash
echo "...above code here..."
This only prints to console (probably obvious), but how can I make it execute? 1. I have made it executable (I believe) by using
sudo chmod +x start2s.sh
I have also enabled permissions like this:
sudo chmod 755 start2s.sh
When I type
sh start2s.sh
it just prints to console. Any help is appreciated.
Upvotes: 0
Views: 59
Reputation: 4969
Some basic scripting tips:
#!/bin/bash
echo 'ls'
will print
ls
and
#!/bin/bash
ls
will give you the output of ls
.
In general, you will put an echo in your script
In the latter case, you will remove the echo from the script once you have verified the corretness.
Upvotes: 1