Write a shell script capable of doing the following:

  Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
ianwahome Offline
Junior Member
Posts: 1
Joined: Apr 2013
Reputation: 0
Post: #1
1. Create a directory "preFinal" in your home directory. In case that such directory exist, rename the existing one into "preFinal.000" and then create empty directory preFinal. While renaming existing preFinal into preFinal.000 you may discover that preFinal.000 also exists, so it needs to be renamed into preFinal.001 and so on.

2. Create empty files "a", "b", "c", etc in directory preFinal in the amount that match the number of directories preFinal*


1. Assume there are no directories preFinal* in your $HOME (very first run of the script). It will create directory preFinal and will create empty file "a" in it.

2. Second run of the same script will result in renaming preFinal into preFinal.000 and creating empty files "a" and "b" in preFinal. At the end of this run you will have empty file "a" in preFinal.000 and empty files "a" and "b" in preFinal

3. The 3rd run of the scrip will result in empty files "a","b","c" in preFinal, files "a","b" in preFinal.000 and "a" in preFinal.001

4. and so on
find quote
nickr Online
Team-Kodi Member
Posts: 16,565
Joined: May 2009
Reputation: 331
Location: Christchurch NZ
Post: #2
Why should I wrote such a script?
What has this to do with xbmc?

If I have helped you or increased your knowledge, click the 'thank user' button to give thanks :) (People with less than 20 posts won't see the "Thank you" button.)
find quote
TugboatBill Offline
Posting Freak
Posts: 825
Joined: Oct 2009
Reputation: 7
Post: #3
That's a simple programming 101 assignment. Things you should ask in this assignment:
What should you use/do after you use the z character?
What language?
What feedback mechanism should you use (log file/on screen/?) if there's a problem, IE permissions.

And, no, I won't write it for you. Wink
find quote