![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Bash and Awk for creating directories and moving files | Kiint | Shell Programming and Scripting | 11 | 07-24-2008 10:30 PM |
| help needed in creating an image from a 7za compressed file | wrapster | SUN Solaris | 0 | 06-20-2008 10:59 AM |
| Bash shell: Creating Preferences | airsmurf | Shell Programming and Scripting | 4 | 05-20-2008 02:49 AM |
| creating directories on the same box | vivek_damodaran | HP-UX | 3 | 11-14-2007 03:06 PM |
| creating directories | carlvernon | UNIX for Dummies Questions & Answers | 3 | 06-01-2006 01:45 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
help needed with creating challenging bash script with creating directories
Hi,
Can someone help me with creating a bash shell script. I need to create a script that gets a positive number n as an argument. The script must create n directories in the current directory with names like map_1, map_2 etcetera. Each directory must be contained within its predecessor. So map_1 contains map_2, map_2 contains map_3 and so forth. Thanks for the help! |
|
||||
|
Code:
# n is 1 by default n=1 # this is a loop where it actually says when n is less then 1 or on do something while [ $n -le $1 ] # this part I don't understand do dir=map_$n mkdir "$dir" && cd "$dir" || exit 1 n=$(( $n + 1 )) done |
|
||||
|
Quote:
while [ 1 -le 4 ]...and then increment 1 by 1..till it reaches 4. cheers, Devaraj Takhellambam |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|