Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Help with script that uses subroutines and parameters

develop unix script

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1 panick1992

panick1992

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 06 January 2015 - 01:26 AM

I will be honest with you guys! I have no idea how to do it. If anybody can help i will truly appreciate!

I want help to develop a unix script that will use two run-time arguments; the rst is a
(specicaltion of a path to a) source folder, the second is a target folder; and it will do the following: 
1)if the source folder does not exist, display a message and exit. 
2)if the target folder does not exist, create it and display an appropriate message; if it does exist, display a message.
3)for each regular le in the source folder,
(a) display its details (name, size, date etc)
(B) ask the user whether the le should be copied
© if the user answers \no" display a message \skipped", otherwise copy
the le to the target, set the copy's permissions to \read-only" , and display a message.

I have to write "subroutine" scripto do the repeated
part, (a)-©.

 

 

 

Develop a unix script(s) that accept a list of files (or a glob) as its input.

For each file:
   1) Find its size
   2)Record the maximum size found in the set of input files
   3)Keep a running total of the sizes found
When all the files have been processed, print out some statistics:
  1)Total size of files
  2)Average size
  3)Size and name of the bigge


#2 lespauled

lespauled

    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1360 posts

Posted 06 January 2015 - 07:44 AM

You haven't even told us what shell you are using.

 

With that said, this sounds a lot like homework......pretty much a guarantee.  We don't do homework for you here.  But, we will help those who truly try to help themselves and get stuck along the way.


My Blog: http://forum.codecal...699-blog-77241/
"Women and Music: I'm always amazed by other people's choices." - David Lee Roth

#3 WingedPanther73

WingedPanther73

    A spammer's worst nightmare

  • Moderator
  • 17757 posts

Posted 06 January 2015 - 09:34 AM

What do you have so far?


Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/


#4 BlackRabbit

BlackRabbit

    CodeCall Legend

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3871 posts

Posted 08 January 2015 - 02:49 AM

Welcome aboard

 

You need to tell us what shell are you about to use, and if started, what do you have so far.

 

In case you are new to Unix/Linux command line just make us now so we can point the way for you.