LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Shell scripting help (https://www.linuxquestions.org/questions/linux-newbie-8/shell-scripting-help-4175606085/)

eloradas 05-16-2017 05:28 PM

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.

Habitual 05-16-2017 06:17 PM

Welcome to LQ:

Sounds like a plan.
Show us your code. :)

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

Thank you,

BW-userx 05-16-2017 06:22 PM

is OP giving out assignments to LQ personal? Someone ask Root if we get credits for that.. someone .. hello?

wpeckham 05-16-2017 08:11 PM

Quote:

Originally Posted by eloradas (Post 5711630)
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.

BW-userx 05-16-2017 08:40 PM

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/

r3sistance 05-17-2017 06:20 AM

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

Habitual 05-17-2017 07:08 AM

https://opensource.com/life/16/10/ho...ical-questions

rtmistler 05-17-2017 12:49 PM

Quote:

Originally Posted by eloradas (Post 5711630)
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.

sharky 05-18-2017 02:14 AM

Hit and run?


All times are GMT -5. The time now is 11:37 AM.