LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 07-28-2011, 02:44 AM   #1
sumeet inani
Member
 
Registered: Oct 2008
Posts: 895
Blog Entries: 26

Rep: Reputation: 48
need help in writing a script


I am using ubuntu 10.04
I plan script named 'search' (no such command by default in my distro)

Code:
ask for string
run 'locate -i string'
give output line prefixed with (1) , (2) , ... so on
ask number of file to open
run 'gnome-open NUMBER'
 
Old 07-28-2011, 02:59 AM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
What exactly is your question? What have you tried so far?

We're not going to write your whole script for you, if that's what you're asking for, especially with only a vague description of what it should do. But we will advise you and help you to overcome any difficulties you come across.

Here are a few useful bash scripting references to help you get started.
http://www.linuxcommand.org/index.php
http://mywiki.wooledge.org/BashGuide
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/index.html
http://www.gnu.org/software/bash/manual/bashref.html
http://wiki.bash-hackers.org/start
http://mywiki.wooledge.org/BashFAQ
http://mywiki.wooledge.org/BashPitfalls

The first one is an excellent tutorial for beginners, and you should definitely read through the second one too for a more detailed conceptual understanding. Also check out the last one, to learn how to avoid many common mistakes.

My advice is to start by figuring out how to do each individual step independently on the command line. Then you can build a script around them to automate the process.

Good luck to you!
 
1 members found this post helpful.
Old 07-28-2011, 03:40 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,245

Rep: Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684
Not bad looking pseudo code. Looks plausible. Good luck
 
1 members found this post helpful.
Old 07-28-2011, 06:38 AM   #4
sumeet inani
Member
 
Registered: Oct 2008
Posts: 895
Blog Entries: 26

Original Poster
Rep: Reputation: 48
This idea occured to me.
So I thought of executing it .
I thought if somebody already did that or there is any utility which does something similiar.

I will read tutorials then put words to action.

Last edited by sumeet inani; 07-28-2011 at 06:39 AM.
 
0 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] writing a script kenny53067 Linux - Newbie 27 07-24-2011 11:59 AM
Help me in writing the script prakash.akumalla Linux - Newbie 7 12-19-2008 02:49 PM
Need help for writing Script vikrambhimbar Linux - Software 2 03-05-2006 05:28 AM
Help Writing a script. teeth44 Programming 2 10-14-2003 01:00 PM
writing a Script spanky5125 Linux - Security 5 01-08-2002 10:22 AM


All times are GMT -5. The time now is 10:29 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration