LinuxQuestions.org
Visit Jeremy's Blog.
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 02-26-2014, 08:08 AM   #1
diw10
LQ Newbie
 
Registered: Feb 2014
Posts: 13

Rep: Reputation: Disabled
Bask script for back up


I need a bash script that does-
-get source path as input from user
-then perform backup
 
Old 02-26-2014, 08:10 AM   #2
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 3,428
Blog Entries: 1

Rep: Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144
With so little description, here is a wireframe of what you asked for:

Code:
echo "What do you want to back up? "

read SOURCE

rsync -var $SOURCE /some/destination/
Fwiw: Bash scripting is not programming. It is scripting.
 
1 members found this post helpful.
Old 02-26-2014, 08:41 AM   #3
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6
Posts: 1,740

Rep: Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555
Quote:
Originally Posted by szboardstretcher View Post
Fwiw: Bash scripting is not programming. It is scripting.
I disagree, a program is defined as " a set of instructions that tell a computer what to do - Merriam-Webster" so a script is actually a program.
 
1 members found this post helpful.
Old 02-26-2014, 08:49 AM   #4
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 3,428
Blog Entries: 1

Rep: Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144
I agree on that point for sure. But that is for the noun 'program' where as I said 'programming' which is a verb. But upon researching the definition for that as well.. it leads to the same thing.

But I personally can't get myself to say that you are a programmer if all you can do is write Bash Scripts!

:/ not sure how i feel about these definitions now. M-W has let me down!!

"What are you doing over there?"

"Writing batch files for windows."

"Man, you programmers know everything."

Last edited by szboardstretcher; 02-26-2014 at 08:50 AM.
 
Old 02-26-2014, 09:00 AM   #5
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6
Posts: 1,740

Rep: Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555
Quote:
Originally Posted by szboardstretcher View Post
But I personally can't get myself to say that you are a programmer if all you can do is write Bash Scripts!
I've had to write some pretty involved (1500+ line) BASH scripts in my time


My loose personal definition is that if there's conditional logic required then it's program / programming.
 
Old 02-26-2014, 09:44 AM   #6
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 3,428
Blog Entries: 1

Rep: Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144
I've certainly had my share of insane bash scripting.

Oh boy,.. You are going to hate this personal philosophy then

I don't even consider PHP, Python or Ruby to be True programming languages. They are interpreted and not truly compiled, and you don't do your own memory management. Therefore, not True programming languages.

True programming languages
  • C
  • C++

scripting
  • bash
  • sh
  • php
  • ruby
  • python

And please dont think for a second that I am arguing! It's just one of those beliefs that got in my head years ago, and I can't undo it.

I'm not actually saying that this is true or canon or good for anything. Just throwing my thoughts out there

Last edited by szboardstretcher; 02-26-2014 at 09:47 AM.
 
Old 02-26-2014, 10:02 AM   #7
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6
Posts: 1,740

Rep: Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555
Bask script for back up

lol, at the day job we do websites and apps handling millions of $ worth of transactions a week and it's done with php

It's all very blurred where scripting and "real" languages are concerned these days.
 
Old 02-26-2014, 10:15 AM   #8
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 3,428
Blog Entries: 1

Rep: Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144
Same here at my current company.

At my last place, Chrysler, they used JAVA to build out just about everything. It was estimated that the total project code was worth 100+ million, due to the number of programmers, consultants, time etc invested into it.

I guess maybe its time to re-define programming and scripting for the new age. Maybe we can break it down to abstraction like so:

First:
Machine Language

Second:
Assembly

Third:
C

Fourth:
Bash
Php
Python

Or now that I'm thinking about it, it really doesn't matter, as long as the job gets done!
 
Old 02-26-2014, 10:19 AM   #9
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 4,389

Rep: Reputation: 688Reputation: 688Reputation: 688Reputation: 688Reputation: 688Reputation: 688
^ i think bash and python are 3gl's... something like sql would be a 4gl.
 
Old 02-26-2014, 10:27 AM   #10
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 3,428
Blog Entries: 1

Rep: Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144
Perhaps.

Isn't bash and python written in C?

So,.. they are themselves one level up from C then?

Last edited by szboardstretcher; 02-26-2014 at 10:31 AM.
 
Old 02-26-2014, 10:44 AM   #11
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian Jessie / sid
Posts: 1,471

Rep: Reputation: 444Reputation: 444Reputation: 444Reputation: 444Reputation: 444
could be an endless debate...

a complex script with lots of 'programmatic' logic in it might be considered programming ?

Anyway...

diw10 appears to be posting from a windows 8 machine
and has posted in Non-*NIX Forums --> programming

bash is mentioned, but not which OS it is to be run on
if the bash is being executed on windows 8, then technically this would be the most appropriate subforum
However, such details should be mentioned in the Post.
Guessing games can be fun, but most of the time irritating to the point where people will either not respond, or respond in a negative fashion.

@diw10
basically we need more information to help you.

here are some links

http://www.gnu.org/software/bash/man...l#SEC_Contents
http://www.tldp.org/LDP/Bash-Beginners-Guide/html/
http://mywiki.wooledge.org/BashGuide

see if they help



Good Luck with your first bash script..
And remember if you need help, try to provide concise details

post [code]your code inside code tags like this[/code]
It will also be helpful to know which Operating System you are running bash on, as well as the version of bash you are using.

You may also like to detail what you want to do with the user supplied input, this may influence the code in some way
What you have asked can be achieved in a number of ways, each being better suited to particular circumstances.

where you can, provide sample input and desired output/result

Last edited by Firerat; 02-26-2014 at 10:47 AM. Reason: oops, fixed /noparse on code block example
 
Old 03-01-2014, 02:07 AM   #12
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Distribution: UBUNTU 5.10 since Jul-18,2006 on Intel 820 DC
Posts: 681

Rep: Reputation: 161Reputation: 161
Quote:
I don't even consider PHP, Python or Ruby to be True programming languages. They are interpreted and not truly compiled, and you don't do your own memory management. Therefore, not True programming languages.
I mean why would anyone do memory management when the OS does it well enough. Does it seem reasonable to think that since you mention only C & C++ are "true" programming languages, you are referring to malloc/free-ing as memory management, when in fact it is the kernel at run time that manages the memory? If this assumption is correct, anyone who uses DIM/REDIM is also managing memory.

Back to the original debate (still not the OPs topic).
In my view, bash scripts as bundled collection of commands are not programming, BUT even bash scripts could qualify if they have elements of control do .. until, if .. then .. elif .. fi etc.

OK
 
Old 03-01-2014, 11:16 AM   #13
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 4,389

Rep: Reputation: 688Reputation: 688Reputation: 688Reputation: 688Reputation: 688Reputation: 688
Quote:
Originally Posted by szboardstretcher View Post
Perhaps.

Isn't bash and python written in C?

So,.. they are themselves one level up from C then?
maybe ? i posted this a while ago about my understanding of the progression of languages:
http://www.linuxquestions.org/questi...2/#post5004837
 
  


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
How to get the control back from expect script to a shell script? techyn Linux - Software 3 08-03-2012 08:13 AM
Bask replace with text output PatrickNew Programming 4 08-11-2008 07:51 PM
how to pass a variable from a called script back to the calling script steven.c.banks Linux - General 2 05-05-2008 02:00 PM
script to back up data? linuxpng2 Linux - Newbie 1 09-19-2006 01:41 PM
Back-up Shell Script apoc013 Linux - Newbie 7 01-23-2004 01:40 PM


All times are GMT -5. The time now is 02:43 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration