LinuxQuestions.org
Visit Jeremy's Blog.
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 05-16-2017, 05:28 PM   #1
eloradas
LQ Newbie
 
Registered: May 2017
Posts: 1

Rep: Reputation: Disabled
Shell scripting help


Create a script that moves files you've downloaded from directory to destination. The script should take two arguments: from and to. The categories could be files with the following characters as the file name's first letters (case insensitive): A to F, G to L, M to R, S to Z. and "-" for the rest. Each of these categories should be represented as a directory in the destination and creation of these directories should be done interactively (Hint: command "read"). However, ask for creation of these subdirectories only if the destination directory itself exists. If it doesn't exists, create an error report and exit prematurely. Check also the existence of the "from" directory and the number of arguments.
 
Old 05-16-2017, 06:17 PM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Welcome to LQ:

Sounds like a plan.
Show us your code.

Or specify what kind of "help" you need exactly.

Thank you,
 
2 members found this post helpful.
Old 05-16-2017, 06:22 PM   #3
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (current), FreeBSD, Win10, It varies
Posts: 9,952

Rep: Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148
is OP giving out assignments to LQ personal? Someone ask Root if we get credits for that.. someone .. hello?
 
Old 05-16-2017, 08:11 PM   #4
wpeckham
Senior Member
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, Fedora, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, Vsido, tinycore, Q4OS
Posts: 3,802

Rep: Reputation: 1728Reputation: 1728Reputation: 1728Reputation: 1728Reputation: 1728Reputation: 1728Reputation: 1728Reputation: 1728Reputation: 1728Reputation: 1728Reputation: 1728
Quote:
Originally Posted by eloradas View Post
Create a script that moves files you've downloaded from directory to destination. The script should take two arguments: from and to. The categories could be files with the following characters as the file name's first letters (case insensitive): A to F, G to L, M to R, S to Z. and "-" for the rest. Each of these categories should be represented as a directory in the destination and creation of these directories should be done interactively (Hint: command "read"). However, ask for creation of these subdirectories only if the destination directory itself exists. If it doesn't exists, create an error report and exit prematurely. Check also the existence of the "from" directory and the number of arguments.
Sounds like a homework assignment.
We can help, but we are NOT going to do your assignment for you. Show us what you have, and we might make suggestions.
 
1 members found this post helpful.
Old 05-16-2017, 08:40 PM   #5
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (current), FreeBSD, Win10, It varies
Posts: 9,952

Rep: Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148
Just a little something to get you started in a direction.
For and Read-While Loops in Bash
http://www.compciv.org/topics/bash/loops/
 
1 members found this post helpful.
Old 05-17-2017, 06:20 AM   #6
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
you may also need one or two of the following but due to the laziness of the first post, I ain't gunna say which

http://tldp.org/LDP/abs/html/fto.html
 
Old 05-17-2017, 07:08 AM   #7
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
https://opensource.com/life/16/10/ho...ical-questions
 
1 members found this post helpful.
Old 05-17-2017, 12:49 PM   #8
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,319
Blog Entries: 13

Rep: Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372
Quote:
Originally Posted by eloradas View Post
Create a script that moves files you've downloaded from directory to destination. The script should take two arguments: from and to. The categories could be files with the following characters as the file name's first letters (case insensitive): A to F, G to L, M to R, S to Z. and "-" for the rest. Each of these categories should be represented as a directory in the destination and creation of these directories should be done interactively (Hint: command "read"). However, ask for creation of these subdirectories only if the destination directory itself exists. If it doesn't exists, create an error report and exit prematurely. Check also the existence of the "from" directory and the number of arguments.
Hi eloradas and welcome to LQ.

Please review the Site FAQ as well as the LQ Rules for further information about what other members are saying to you. LQ and the members are not here to provide on call support or provide free support for questions. Instead LQ is here to help you to learn more about Linux. Therefore showing your effort with this is important. Further, without having shown any of your effort, LQ members cannot know what script language you are using, what environment you have, or what existing knowledge level you have with scripting, therefore any answers they may offer would potentially be incorrect advice.
 
Old 05-18-2017, 02:14 AM   #9
sharky
Member
 
Registered: Oct 2002
Posts: 537

Rep: Reputation: 74
Hit and run?
 
  


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
LXer: Shell Scripting Part 3: Decision Control Structures in Shell Scripts LXer Syndicated Linux News 0 05-05-2015 10:01 PM
LXer: Shell Scripting Part 2: Accepting Inputs and Performing Shell Arithmetic LXer Syndicated Linux News 0 04-30-2015 07:10 AM
LXer: Shell Scripting Part I: Getting started with bash scripting LXer Syndicated Linux News 0 04-29-2015 08:03 AM
win32,shell code,shell programming,shell scripting? mr.cracker Linux - Newbie 4 07-12-2013 11:20 PM
teaching shell scripting: cool scripting examples? fax8 Linux - General 1 04-20-2006 04:29 AM

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

All times are GMT -5. The time now is 07:32 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