I went through several tutorials already so here's some of the history of the commands and whatnot I've done and went through.
I mostly followed the video from the previous blog posts and went through a lot of videos from this website http://www.bashscripts.info/
1 pwd
2 cd documents
3 pwd
4 history
5 printf history
6 history
7 clear
8 history
9 pwd
10 cd ..
11 cd ..
12 cd ..
13 cd ~
14 pwd
15 ls -al
16 cd videos
17 ls -al
18 cd /usr
19 pwd
20 ls -al
21 cd ..
22 cd videos
23 cd ~
24 cd videos
25 pwd
26 history
27 history>history.txt
Here's also a few scripts I had already practiced on making. This script says hi to the user, sets random variables, write a string and then gives the computer command back.
#!/bin/bash
clear
echo "The Script Starts now."
echo "Hi, $USER!"
echo
echo "I'm setting two variables now."
COLOUR="black"
VALUE="9"
echo "This is a string: $COLOUR"
echo "And this is a number: $VALUE"
echo
echo "I'm giving you back your prompt now."
echo
Here's another practice one that counts down to party time.
#!/usr/bin/bash
for ((i=10; i>0; i--)); do
echo $i
sleep 1
done
echo Party Time!
I also found a useful script of getting a youtube video but I didn't write it out myself so I don't take credit.
#!/bin/bash
#Youtube Video Downloader
#coder ref: Anil Dewani
read -p "Youtube.com URL :" url
read -p "Name the video(no spaces please) :" name
wget ${url} -O source.txt >/dev/null 2>&1
videoid=$(echo $url | awk -F "v=" '{print $2}')
ticket=$(grep "&t=" source.txt | awk -F "&t=" '{print $2}' | cut -d"&"
-f1)
base="http://www.youtube.com/get_video?video_id="
downloadurl=${base}${videoid}"&t="${ticket}
rm -f source.txt
wget ${downloadurl} -O ${name}.flv >/dev/null 2>&1
echo "Video Download Succesfull. File saved as ${name}.flv"
No comments:
Post a Comment