04-28-2009
Quote:
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!
Looks like a homework question, so here's a hint: given the number "n", loop from 1 through n and create a string that represents the directory tree you want. Then use the "-p" option of "mkdir" command to create the directory tree.
Hope that helps,
tyler_durden
______________________________________________
"Only after disaster can we be resurrected."
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a security system that FTPs the camera files to my machine, however I want to sort the pictures (taken every 30s) into directories by hour.
Every picture uses the following file format.
yymmddhhmmsstt.jpg (where tt is the milliseconds)
I am thinking the for loop is best
for file... (11 Replies)
Discussion started by: Kiint
11 Replies
2. UNIX for Dummies Questions & Answers
Hi all,
I need your help in creating a script.
At the moment, we run a daily procedure incorporating the following commands, which we would like within a script using the bash shell.
cd /var/adm/Syslog
tail -1 /var/adm/messages
grep "`date '+%b %e'`" /var/adm/messages > syslog.`date... (4 Replies)
Discussion started by: wthomas
4 Replies
3. Shell Programming and Scripting
0
Hi,
I am looking for a way of creating multiple directories using the mkdir -p command in a shell script.
I'm working with an Ubuntu machine and try to do something like that:
#!/bin/sh
... (3 Replies)
Discussion started by: frymor
3 Replies
4. Programming
Hi.
I have two text files(tables) which include some information and I want to make some query codes using them.
First of all, I want to create bash script that read this two tables, create/open database and insert data from files into database.
#!/bin/bash
while read line; do
... (1 Reply)
Discussion started by: rlaxodus
1 Replies
5. Shell Programming and Scripting
Hi, I am a new on this forum but i like :) I need a script in bash which will be crating a new user with folder for websites. For example: I will run this program and he creating a new user(with my name) and folder whcich name like user and if i will localho/~user in browser, she show me files from... (1 Reply)
Discussion started by: puclavv
1 Replies
6. Shell Programming and Scripting
Hello Everyone,
I am currently trying to write a Bash Script to call a PCAP file. The command I will use in the script will be the following:
tshark -r test.pcap -T fields -e frame.number -e frame.time -e eth.src -e eth.dst -e ip.src -e ip.dst -r ip.proto -E header=y -E separator=, quote=d -E... (4 Replies)
Discussion started by: MrTuxor
4 Replies
7. Shell Programming and Scripting
how can i move "dataName".sql.gz into a folder called 'database' and then move "$fileName".tar.gz * .htaccess into a folder called 'www' with the entire gzipped file being "$fileName".tar.gz? Is this doable or overly complex.
so
mydemo--2015-03-23-1500.tar.gz
> database
-... (5 Replies)
Discussion started by: wyclef
5 Replies
8. Shell Programming and Scripting
I've got this script to loop through all folders and move files that are more than 2 years old. I'm using the install command because it creates the necessary directories on the destination path and then I remove the source. I'd like to change the script to use the mv command since it is much... (4 Replies)
Discussion started by: consultant
4 Replies
9. Shell Programming and Scripting
I wrote a code to find codons in a DNA string. The only problem I have is how do I make the code only work for a file with DNA. This means the file only has the characters a,c,g,t and no white space characters. (3 Replies)
Discussion started by: germany1517
3 Replies
10. Shell Programming and Scripting
Hey, im fairly new to unix and Im trying to make this unix project that would display a menu and do the following.
MENU
===========================
(p, P) Print users info
(a, A) Add new user
(s, S) Search user
(d, D) Delete user
(x,X) Exit
Enter your choice:
Trying to... (3 Replies)
Discussion started by: ultimaxtrd
3 Replies
LEARN ABOUT NETBSD
makedev.local
MAKEDEV.LOCAL(8) BSD System Manager's Manual MAKEDEV.LOCAL(8)
NAME
MAKEDEV.local -- create site-specific device special files
SYNOPSIS
MAKEDEV.local [-fMsu] [-m mknod] [-p pax] [-t mtree] {all | site-specific-argument} [...]
DESCRIPTION
MAKEDEV.local is used to create site-specific device special files. Each argument may be the word all or a site-specific argument. By
default, there are no valid site-specific arguments, and the all argument has no effect; This may be changed by editing the script.
The script is in /dev/MAKEDEV.local. Devices are created in the current working directory; in normal use, MAKEDEV.local should be invoked
with /dev as the current working directory.
Supported options for MAKEDEV.local are the same as for MAKEDEV(8).
FILES
/dev special device files directory
/dev/MAKEDEV script that invokes MAKEDEV.local with the all argument.
/dev/MAKEDEV.local script described in this man page
SEE ALSO
config(1), intro(4), MAKEDEV(8), mknod(8)
HISTORY
The MAKEDEV.local command appeared in 4.2BSD. Handling of the same command line options as MAKEDEV(8), and the use of MAKEDEV(8) as a func-
tion library, was added in NetBSD 5.0.
NOTES
The relationship between MAKEDEV.local and MAKEDEV(8) is complex:
o If MAKEDEV(8) is invoked with the all or local argument, then it will invoke MAKEDEV.local as a child process, with options similar to
those that were originally passed to MAKEDEV(8), and with the all argument.
o MAKEDEV.local uses shell functions defined in MAKEDEV(8). This is done by loading MAKEDEV(8) using the shell ``.'' command, with the
MAKEDEV_AS_LIBRARY variable set (to inform MAKEDEV(8) that it should behave as a function library, not as an independent program).
BSD
August 6, 2011 BSD