LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-12-2011, 05:48 AM   #1
Mr. Alex
Senior Member
 
Registered: May 2010
Distribution: No more Linux. Done with it.
Posts: 1,238

Rep: Reputation: Disabled
Lightbulb Help me to create a bash script


Hi!
I need to create a bash script with "if" statements and to do that I need to learn some bash programming. I will probably do it later but I want to create some script today so maybe someone can help me with that...

The script should do this:
Code:
I enter something like this string with a script path:
$ ~/watch-script http://www.youtube.com/watch?v=OI3gKGhe0QM

script does:

cd /tmp
$URL = http://www.youtube.com/watch?v=OI3gKGhe0QM

if (clive "$URL" -f mp4_1080p doesn't output an error) than
 clive "$URL" -f mp4_1080p ; gnome-mplayer the newest file in /tmp

else if (clive "$URL" -f mp4_720p doesn't output an error) than
 clive "$URL" -f mp4_720p ; gnome-mplayer the newest file in /tmp

else if (clive "$URL" -f flv_480p doesn't output an error) than
 clive "$URL" -f flv_480p ; gnome-mplayer the newest file in /tmp

else
 echo 'error'

Last edited by Mr. Alex; 06-12-2011 at 09:23 AM.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 06-12-2011, 07:40 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
Ok .. so you have the pseudo'ish code ... what is your actual question?

Also, your following statement would seem counter productive:
Quote:
I need to learn some bash programming. I will probably do it later
Does this imply you would like someone here to do this for you and when you get around to learning you will do more??
 
Old 06-12-2011, 09:22 AM   #3
Mr. Alex
Senior Member
 
Registered: May 2010
Distribution: No more Linux. Done with it.
Posts: 1,238

Original Poster
Rep: Reputation: Disabled
That's about right.
 
0 members found this post helpful.
Old 06-12-2011, 09:27 AM   #4
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
http://linuxcommand.org/wss0090.php
 
2 members found this post helpful.
Old 06-13-2011, 12:21 AM   #5
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
Quote:
That's about right.
Sorry to disappoint you then. No one here will do it for you but all are happy to help you.
 
1 members found this post helpful.
Old 06-14-2011, 12:51 AM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
See also http://rute.2038bug.com/index.html.gz http://tldp.org/LDP/Bash-Beginners-G...tml/index.html http://www.tldp.org/LDP/abs/html/
 
2 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using vi to create bash shell script BBFeltham Linux - Newbie 8 07-28-2008 08:02 PM
Create and run a bash script BallsOfSteel Programming 9 07-04-2008 12:48 AM
Bash Script Help - Trying to create a variable inside script when run. webaccounts Linux - Newbie 1 06-09-2008 02:40 PM
Trying to create a transcoding script (BASH) Phyrexicaid Programming 3 10-15-2007 12:20 PM
How to create a bash script to count? Alinuxnoob Programming 4 01-28-2007 10:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration