Bash shell script to flip through directories and perform a few actions -


Hello, I have a question about a script that I have a problem with. I did something like that a few years ago and based on that (which was on a different server) I need to run a script from that directory which has many directories and makes it a directory for each directory and it changes the ownership script:

 #! DIR * in / bin / bash *; Do MkDir $ DIR / Photo 2; Chown Apache: Apache $ DIR / photos2; Chmod 777 $ DIR / Photo 2; 

I try to run an unexpected token 'Do'

while attempting to run the syntax error, I am sure that this is something silly that I am missing, any help Would be appreciated. DOS was in the format when I saw funny things happened with the script / p>


Are you writing any chance to write on any Windows platform and trying to run it from the Bash shell at some other location?

dos2unix script name

On the shell shell, usually dos2unix , if you think, try to turn on

 Code> 

and then run the script again.


Another investigation, are you sure you have an error in not saying "unexpected token" and not 'done'?
Still, I suggest you


In the meantime, you should do your work from the base directory (when your filenames do not have SPACE characters).

  #! / Bin / Bash $ DIR (Search - Type D); Do MkDir $ DIR / Photo 2; Chown Apache: Apache $ DIR / Photos2; Chmod 777 $ DIR / Photo 2; done  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -