Write a shell script capable of doing the following:
#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*

Example:

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
Reply
#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 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#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
Reply

Logout Mark Read Team Forum Stats Members Help
Write a shell script capable of doing the following:0