Kodi Community Forum
Write a shell script capable of doing the following: - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Discussions (https://forum.kodi.tv/forumdisplay.php?fid=222)
+--- Forum: Off-Topic (https://forum.kodi.tv/forumdisplay.php?fid=113)
+--- Thread: Write a shell script capable of doing the following: (/showthread.php?tid=163591)



Write a shell script capable of doing the following: - ianwahome - 2013-04-29

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


RE: Write a shell script capable of doing the following: - nickr - 2013-04-29

Why should I wrote such a script?
What has this to do with xbmc?


RE: Write a shell script capable of doing the following: - TugboatBill - 2013-04-29

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