![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Shells | dino_leix | UNIX for Advanced & Expert Users | 3 | 06-08-2005 03:07 AM |
| How many kinds of IPC are there in FREEBSD? | cantona | High Level Programming | 1 | 08-12-2004 11:16 PM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
different kinds of shells
Can anyone tell me about the classification and significance of variuos unix shells and why is only sh used for most shell scripting?
|
| Forum Sponsor | ||
|
|
|
|||
|
Write a single bash shell script which does the following:
1. It accepts a single argument which can be either the string toupper or the string tolower. If the argument given by the user is toupper, the script will convert all of the names of the regular files (not directories) in the current directory to uppercase. Thus, file file.txt will become FILE.TXT, file Report.doc will become REPORT.DOC, etc. If the argument provided to the script is the string tolower, the files in the current directory will be renamed to the equivalent lower case ones. For example, Report.doc will become report.doc, etc. If the script is given no argument, then it will not try to rename any of the files in the current directory. (marks 30%). 2. The files in the current directory (whether their name has changed or not in part 1), are moved to appropriate subdirectories, where the name of the appropriate subdirectory is the extension of the file being moved. For example, files report1.doc, report2.doc will be moved to a subdirectory doc, with the names REPORT1.DOC, REPORT2.DOC (assuming the script was called with the string toupper as argument.) If the directory does not exist, it will be created by the script. If a file does not have an extension it will not be moved to a subdirectory. (marks 35%). 3. There is a possibility that when a file is moved to the appropriate subdirectory, the subdirectory already contains a file with an identical name. Modify the script so that if such a file already exists, the moved file will be renamed by appending the number 1 (or the next unique integer) to it. For example, if REPORT.DOC is moved to subdirectory doc, but there is already a file REPORT.DOC inside doc, then the moved file will be renamed as REPORT.DOC1. If a file REPORT.DOC1 already exists inside doc, then the moved file will be renamed as REPORT.DOC2, and so on. |