For Loop Range Create Directories


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting For Loop Range Create Directories
# 1  
Old 06-02-2011
For Loop Range Create Directories

Hello,
I am a bit stumped on this. I am attempting to create 24 empty directories with a loop. Seems like I have incorrect syntax. When I run the following command I get the error below.

Command
Code:
$ for i in {2..24}; do mkdir $i_MAY_2011 ; done

Error x 24
Code:
mkdir: missing operand
Try `mkdir --help' for more information.

When I run the command as so it works but it creates brackets in the directory name which is unacceptable.

Command
Code:
$ for i in {2..24}; do mkdir {$i}_OPRA_MAY_2011 ; done

Directory Created
Code:
{N}_OPRA_MAY_2011

Would someone please be kind enough to explain what I am doing wrong here?

Thanks,
Jaysunn
# 2  
Old 06-02-2011
Code:
$ for i in {2..24}; do mkdir ${i}_MAY_2011 ; done

This User Gave Thanks to bartus11 For This Post:
# 3  
Old 06-02-2011
SOLVED

Hello,
This works perfectly now. Thank you for your time.

jaysunn
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

TCL script to capture range of lines and create two independent variables

Hi I am having a code as stated below module abcd( a , b , c ,da , fa, na , ta , ma , ra , ta, la , pa ); input a , b, da ,fa , na , ta , ma; output c , ra ,ta , la ,pa ; wire a , b , da , fa ,na , ta , ma; // MBIST Structures... (1 Reply)
Discussion started by: kshitij
1 Replies

2. Shell Programming and Scripting

awk to create variables to pass into a bash loop to create a download link

I have created one file that contains all the necessary info in it to create a download link. In each of the lines /results/analysis/output/Home/Auto_user_S5-00580-6-Medexome_67_032/plugin_out/FileExporter_out.67... (8 Replies)
Discussion started by: cmccabe
8 Replies

3. Solaris

File System Error: BAD SUPERBLOCK AT BLOCK 16: NUMBER OF DIRECTORIES OUT OF RANGE

Hi All, we are having a file system error in one of our servers. The server failed to boot in usual user mode. Instead boot with single user mode and requesting to run a FSCK manually to repair the corrupted. see the below output. Netra T2000, No Keyboard Copyright 2008 Sun Microsystems,... (5 Replies)
Discussion started by: Buddhike G
5 Replies

4. Shell Programming and Scripting

How to create individual entries from a range of numbers?

I want to create entries based on the series as in examples below: Input: 2dat3 grht-5&&-15 3dat3 grht-16&&-30 4dat3 ftht-4&&-12 5sat3 ftht-16&&-20 Output: 2dat3 grht-5 2dat3 grht-6 2dat3 grht-7 2dat3 grht-8 (7 Replies)
Discussion started by: aydj
7 Replies

5. Shell Programming and Scripting

use variable to set the range of a for loop

Hi; For sure there's an easy answer to this one that I am not finding.. I first set a variable, say b1a:] max=5 then I want to use max to set the range for a for loop like so (it should run for i in 1:5) b1a:] for i in {1..$max}; do echo $i; done {1..5} I would like the output... (2 Replies)
Discussion started by: jbr950
2 Replies

6. Shell Programming and Scripting

loop directories mv files to target in range

Hello, Currently I have a painstaking process that I use to move file for a monthly archive. I have to run the same two commands for 24 different directories. I wish to have a script with a for loop automate this and I have not been able to succeed. Here is what I do 24 times. I know this is... (5 Replies)
Discussion started by: jaysunn
5 Replies

7. Shell Programming and Scripting

Create range from a list

Hello everyone, I am trying to create a script that will make a range or ranges based on a sorted list of numbers. Eg. If the list is like 1 2 3 4 5 6 7 12 13 14 15 The output range should be: 1-7 12-15 (9 Replies)
Discussion started by: run_time_error
9 Replies

8. Shell Programming and Scripting

To Create range of values

Hi, I have a file with the below like values with integers only in sorted order (May or may not be in sequence) Eg: File1.txt ----------- 1 2 3 4 5 6 . . . . . 10000 My requirement here is to create a range of values out put to a temp k (4 Replies)
Discussion started by: shiva447
4 Replies

9. Shell Programming and Scripting

check if multiple directories exist else create missing directories

Hi , I 'm trying to check if multiple directories exist on a server, if not create the missing ones and print " creating missing directory. how to write this in a simple script, I have made my code complex if ; then taskStatus="Schema extract directory exists, checking if SQL,Count and... (7 Replies)
Discussion started by: ramky79
7 Replies

10. Shell Programming and Scripting

Range specification in for loop

Hello Friends, I want to use range in for loop. For that i used (..) operator but it is not working. Ex: for i in 1..24 do echo $i done Instead of printing 1 to 24 nos, it gives o/p as: 1..24 Please help me Thanks in advance. (2 Replies)
Discussion started by: Niyati
2 Replies
Login or Register to Ask a Question