LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-10-2012, 09:36 AM   #1
Khymych
LQ Newbie
 
Registered: Mar 2012
Posts: 5

Rep: Reputation: Disabled
Smile Help me think of "bash script" which will do a few operations


Help me think of "bash script" which will do a few operations. Need to write directly to that this "bash script" will do (no title) The more operations the better. Thanks in advance!
"Excuse me for does not literacy"
 
Old 03-10-2012, 09:58 AM   #2
rabbit2345
Member
 
Registered: Apr 2007
Location: SC
Distribution: Kubuntu 20.04 LTS
Posts: 378

Rep: Reputation: 41
Hi,

You will need to be a bit more specific on the types of "operations" you want to perform with the bash script. A bash script can be made to do anything from a simple keyboard game to a system maintenance script. There are so many things it can do that without you specifying what it is you want to do, nobody can help you. Please, tell us more about what you want to do, like move files, copy stuff, etc.


good luck,
rabbit2345
 
Old 03-10-2012, 10:14 AM   #3
Khymych
LQ Newbie
 
Registered: Mar 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
I need to write a "bash script", which will need to write until June, and I need to invent what this script will do. I understand that it can do all, but the problem is that I do not understand for scripts. I will study this in the future. A theme to choose now. So please help think of some operations that this script will do. 2-3 may be more action. Thank you!
 
Old 03-10-2012, 10:40 AM   #4
rabbit2345
Member
 
Registered: Apr 2007
Location: SC
Distribution: Kubuntu 20.04 LTS
Posts: 378

Rep: Reputation: 41
Hi,

If what you mean is that you need to write a script by June, and you need help thinking of what the script should do, then I can give you a few ideas. If you want to go simple, then a simple backup script is easy and useful. You can add smaller features like timers, selective backup, compression, etc. to meet the complexity requirement.

http://tldp.org/LDP/Bash-Beginners-G...ers-Guide.html is a good starting point. I also used this guide to help me learn some basic stuff and it has served me well over the years.


good luck,
rabbit2345
 
Old 03-10-2012, 10:58 AM   #5
Khymych
LQ Newbie
 
Registered: Mar 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
Thank you very much!
 
Old 03-10-2012, 11:06 AM   #6
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,225

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Quote:
Originally Posted by Khymych View Post
I need to write a "bash script", which will need to write until June, and I need to invent what this script will do.
You mean you're cheating by asking for ideas here?

That said, here are two large Bash applications that should inspire you:

Last edited by dugan; 03-10-2012 at 11:10 AM.
 
Old 03-10-2012, 04:04 PM   #7
Khymych
LQ Newbie
 
Registered: Mar 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
I did not cheating, I invented the name, thanks
 
Old 03-11-2012, 01:38 AM   #8
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Scripting is essentially the art of scratching the itch. You find something you need or want to do that would be repetitive and tedious to do by hand, and write a script to automate it.

Over the years I've written many scripts. Most of them have been one-shots written to handle a particular issue, and discarded when done, but there are also more generally useful ones that I've kept around. Some examples...
  • A pair of scripts that copy the filenames and metadata from from one series of audio files to another, when I wanted to replace some old mp3 albums with better ogg vorbis copies.
  • Other scripts to batch-convert flac files to ogg, apply replay gain, remove unwanted meta-tags from them, and generate simple playlists. I'm now slowly working on creating a large one-stop rip/convert/edit script that will unify everything.
  • Scripts to download sequences of comics from webcomics I like, format the filenames, and store them in a directory structure of my choosing.
  • A script that provides a more interactive and functional rmdir. It checks for the existence of sub-files, lists them out if desired, and lets me decide what to do.
  • A function to control the output of ls (files only, dirs only, long format, etc.), which I use in conjunction with various aliases.
  • A function for setting the IFS variable in my shell to various preset values.
  • A script to clean up the formatting of html files and remove unwanted tags (to make other scripting easier).
  • A one-step checksum comparison script.
  • Scripts to colorize and de-colorize text output.
  • Scripts for renaming files (in particular, one that zero-pads numbers in filenames).
  • Scripts to enable and disable, or execute in specific ways, various programs/services/features on my system that I use only occasionally (often launched through a gui hotkey or icon).
  • A function for editing scripts (it launches my editor with a basic script template pre-loaded and automatically chmods it.)
 
Old 03-11-2012, 06:43 AM   #9
Khymych
LQ Newbie
 
Registered: Mar 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
I've thought about subject "Back up". What do you think about this subject?
 
  


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
bash script: using "select" to show multi-word options? (like "option 1"/"o zidane_tribal Programming 7 12-19-2015 01:03 AM
[SOLVED] troubles with bash script tests "-z" and "-n" SaintDanBert Linux - Software 7 04-10-2012 09:26 AM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
Shell and batch operations on hidden files but not on ".." & "." danielsbrewer Linux - Software 5 09-12-2007 08:06 AM
How to write a bash script to replace all "KH" to "K" in file ABC??? cqmyg5 Slackware 4 07-24-2007 09:00 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:27 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
Open Source Consulting | Domain Registration