Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to use a Shell Script for specific commands Post 302360612 by dratech09 on Friday 9th of October 2009 12:49:23 PM
Old 10-09-2009
Every time I run the command I get:
Code:
mkdir: cannot create directory `./out': File exists
mkdir: cannot create directory `./out': File exists
mkdir: cannot create directory `./out': File exists

I'm assuming this means that somethings going on to where its staying put in the folder where all the directories are, and not going through all of the different directories inside the main one.

Here is what I have:
Code:
cat folders.list | \
while read ENTRY
do
mkdir ./out && for x in *.cfm; do awk '{FS="<!-- InstanceBeginEditable name=\"title\" -->"; RS="<!-- InstanceEndEditable -->"; print "<!-- InstanceBeginEditable name=\"title\" -->" $2  "<!-- InstanceEndEditable -->"}' $x > ./out/$x; done
for x in *.cfm; do awk '{FS="<!-- InstanceBeginEditable name=\"content\" -->" ; RS="<!-- InstanceEndEditable -->"; print "<!-- InstanceBeginEditable name=\"content\" -->" $2 "<!-- InstanceEndEditable -->"}' $x >> ./out/$x; done
for x in *.cfm; do awk '{FS="<!-- InstanceBeginEditable name=\"contact\" -->" ; RS="<!-- InstanceEndEditable -->"; print "<!-- InstanceBeginEditable name=\"contact\" -->" $2 "<!-- InstanceEndEditable -->"}' $x >> ./out/$x; done
for x in *.cfm; do sed -i -e 's/<!-- InstanceBeginEditable name="title" -->html<!-- InstanceEndEditable -->//' -e 's/<!-- InstanceBeginEditable name="title" -->HTML<!-- InstanceEndEditable -->//' -e 's/<!-- InstanceBeginEditable name="title"  --><!-- InstanceEndEditable -->//' -e 's/<!-- InstanceBeginEditable name="content" --><!-- InstanceEndEditable -->//' -e 's/<!-- InstanceBeginEditable name="content" -->html<!-- InstanceEndEditable -->//' -e 's/<!-- InstanceBeginEditable name="content" -->HTML<!-- InstanceEndEditable -->//' -e 's/<!-- InstanceBeginEditable name="contact" --><!-- InstanceEndEditable -->//' -e 's/<!-- InstanceBeginEditable name="contact" -->html<!-- InstanceEndEditable -->//' -e 's/<!-- InstanceBeginEditable name="contact" -->HTML<!-- InstanceEndEditable -->//' ./out/$x; done
done

And here is what I have in my "folders.list" file:
Code:
/ag/ag1
/ag/
/file/
/account/
/yadda/


Last edited by dratech09; 10-09-2009 at 03:12 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to run unix commands in a new shell inside a shell script?

Hi , I am having one situation in which I need to run some simple unix commands after doing "chroot" command in a shell script. Which in turn creates a new shell. So scenario is that - I need to have one shell script which is ran as a part of crontab - in this shell script I need to do a... (2 Replies)
Discussion started by: hkapil
2 Replies

2. Shell Programming and Scripting

shell script to run a few commands help!

Hi friends this is first post i am very new to shell scripting so i require your expertise to do the following thank u I need to write a shell script which will run the following commands pg_dump bank > backup(Enter) Wait for bash prompt to appear coz it indicates that the command is... (23 Replies)
Discussion started by: perk_bud
23 Replies

3. Shell Programming and Scripting

How to get ascii value using shell commands/script

Hi gurus, Need command/code to get the ASCII value for a character say 65 for A and vice versa in shell script. Thanks in advance (2 Replies)
Discussion started by: kittu1979
2 Replies

4. Red Hat

how to write shell specific commands?

I am using Fedora 8,Red hat 9. Whenever we write a new command. Then we goto "/usr/bin" and then place this in this directory.And hence we can use it as a command anywhere from the terminal. We generally see commands like "trap" which run only in bash shell.We also have other shell specific... (1 Reply)
Discussion started by: nsharath
1 Replies

5. Shell Programming and Scripting

Why can't embed commands like fg or bg in a shell script ?

Hi Can someone explain in an easy way that why can't embed commands like fg or bg in a shell script ? (4 Replies)
Discussion started by: qiulang
4 Replies

6. Shell Programming and Scripting

Using Ex editor commands in a shell script - Help!

Hi all, I am trying to use the Ex editor and its commands in a script - more specifically within an if statement within a while loop. Here are the basics of the loop: cat $file1 | while read line do grep $line $file2 if ] then echo $line > $file2 elseex $file2 /ESI185... (4 Replies)
Discussion started by: luke222010
4 Replies

7. Shell Programming and Scripting

Linux commands in shell script?

I am trying to learn to write basic shell scripts. I have a little experience with perl but none with shell. I am trying to write a simple script to write the last 15 or so lines of log files for my web server to a temp file so I can view all at once. Here's what I have. Are you not able to use... (6 Replies)
Discussion started by: ktb231
6 Replies

8. UNIX for Dummies Questions & Answers

Commands to run from shell script

Hi script> isumid 98765432 if i give above command in cmd prompt it is running the same thing if i give inside the shell script it is not working below is the code #!/bin/bash isumid 98765432 please give me a solution (16 Replies)
Discussion started by: Ramrangasamy
16 Replies

9. Shell Programming and Scripting

Script to run commands at a specific time.

Hello All, I have written a script which which is working fine to a certain logic of it. But i want a part of the script to run two commands at 00:10 hrs every day. These two command are 1. rm -rf /path/to/folder 2. mail the content of a file. How do i achieve this. Thanks. ... (4 Replies)
Discussion started by: Siddheshk
4 Replies

10. UNIX for Beginners Questions & Answers

Two exec commands in one shell script?

Hi Folks - Is there a way to add two execs to one script? For instance, I need to redirect the stdout and stderr to two separate directories. I want to do this: #::-- Direct STDOUT and STDERROR to repositories --::# exec 2>"${_ERRORFILE}" > "${_LOGFILE}" exec 2>"/new/path/file.err" >... (7 Replies)
Discussion started by: SIMMS7400
7 Replies
mkdir(1)							   User Commands							  mkdir(1)

NAME
mkdir - make directories SYNOPSIS
mkdir [-m mode] [-p] dir... DESCRIPTION
The mkdir command creates the named directories in mode 777 (possibly altered by the file mode creation mask umask(1)). Standard entries in a directory (for instance, the files ".", for the directory itself, and "..", for its parent) are made automatically. mkdir cannot create these entries by name. Creation of a directory requires write permission in the parent directory. The owner-ID and group-ID of the new directories are set to the process's effective user-ID and group-ID, respectively. mkdir calls the mkdir(2) system call. setgid and mkdir To change the setgid bit on a newly created directory, you must use chmod g+s or chmod g-s after executing mkdir. The setgid bit setting is inherited from the parent directory. OPTIONS
The following options are supported: -m mode This option allows users to specify the mode to be used for new directories. Choices for modes can be found in chmod(1). -p With this option, mkdir creates dir by creating all the non-existing parent directories first. The mode given to intermedi- ate directories will be the difference between 777 and the bits set in the file mode creation mask. The difference, how- ever, must be at least 300 (write and execute permission for the user). OPERANDS
The following operand is supported: dir A path name of a directory to be created. USAGE
See largefile(5) for the description of the behavior of mkdir when encountering files greater than or equal to 2 Gbyte ( 2**31 bytes). EXAMPLES
Example 1: Using mkdir The following example: example% mkdir -p ltr/jd/jan creates the subdirectory structure ltr/jd/jan. ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of mkdir: LANG, LC_ALL, LC_CTYPE, LC_MES- SAGES, and NLSPATH. EXIT STATUS
The following exit values are returned: 0 All the specified directories were created successfully or the -p option was specified and all the specified directories now exist. >0 An error occurred. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |CSI |enabled | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
rm(1), sh(1), umask(1), intro(2), mkdir(2), attributes(5), environ(5), largefile(5), standards(5) SunOS 5.10 1 Feb 1995 mkdir(1)
All times are GMT -4. The time now is 09:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy