Is there a way to create a new directory, containing subdirectories and documents?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
0
down vote

favorite












For web-development practice I'm using a LAMP stack, on Ubuntu 17.10. For this I'm creating directories within /var/www, each directory is named after a project.



To create a subdirectory I use the terminal and:



david@Ed:/var/www/html$ mkdir projectName
david@Ed:/var/www/html$ cd projectName
david@Ed:/var/www/html/projectName$ mkdir css img js
david@Ed:/var/www/html/projectName$ touch index.html
david@Ed:/var/www/html/projectName$ ls
css img index.html js


This works. And, in all honesty, is far from arduous. But, is there a means by which I can simplify this?



I'm aware that:



mkdir -p projectName/css


Will create both the css, and the parent projectName, directory (if that parent doesn't already exist), but it still leaves the requirement of creating the other two directories and the index.html file (again, this is not particularly arduous but feels like it should be unnecessary).



Ideally I'd like that the command mkdir <projectName> when run in the /var/www directory would create the <projectName> directory with the css, img, js directories and the index.html document (that document ideally containing the skeleton of a valid html document*). However I accept that abusing the mkdir command would likely lead to unforeseen/predictable edge-cases and consequences, so probably the best compromise is a script of some kind.



With the above in mind, I created the following (naive/simple) script:



#!/bin/bash
mkdir $@
cd $@
mkdir css img js
touch index.html


I call the above script as follows:



./createDir.sh projectName


This works but is less than ideal; the problems:



  1. the created index.html has a type of plain text document (text/plain), rather than the expected HTML document (text/html), and of course

  2. has none of the structure of an HTML document (as outlined in the single footnote), because I didn't add any content (and haven't yet found a way of creating said content in a script).

Also, somewhat predictably, both the css and js directories would also – ideally – be created with documents (project.css and project.js) intact.



So, is there a means by which I can create – with the use of a script, or otherwise – a directory with its subdirectories and documents?




*. As a rudimentary example:



<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="js/project.js"></script>
<link href="css/project.css" rel="stylesheet" />
</head>
<body></body>
</html>






share|improve this question



















  • Related: Create file and its parent directory
    – steeldriver
    2 hours ago










  • what is wrong with mkdir -p projectName/css,js,img? Plus you can add a && touch projectName/index.html to create the file, or use a cp to copy a index.html to this location.
    – Rinzwind
    2 hours ago











  • @Rinzwind: absolutely nothing is wrong with it, except that I hadn't come across that syntax before and didn't know of its existence. I do like - and hadn't considered - the approach of copying existing template files. Thank you.
    – David Thomas
    2 hours ago











  • @DavidThomas well you can also create the file on the fly by doing a "echo content > index.html" ;)
    – Rinzwind
    2 hours ago






  • 1




    I would just like to point out that creating a user with adduser does something similar. For that purpose skeleton is used, which is in fact a template like proposed in some answers. If you make a template/skeleton with all directories and files, the only thing you need is copy (cp -fvr <template> <destination>) after creating a directory for a new project.
    – nobody
    2 hours ago

















up vote
0
down vote

favorite












For web-development practice I'm using a LAMP stack, on Ubuntu 17.10. For this I'm creating directories within /var/www, each directory is named after a project.



To create a subdirectory I use the terminal and:



david@Ed:/var/www/html$ mkdir projectName
david@Ed:/var/www/html$ cd projectName
david@Ed:/var/www/html/projectName$ mkdir css img js
david@Ed:/var/www/html/projectName$ touch index.html
david@Ed:/var/www/html/projectName$ ls
css img index.html js


This works. And, in all honesty, is far from arduous. But, is there a means by which I can simplify this?



I'm aware that:



mkdir -p projectName/css


Will create both the css, and the parent projectName, directory (if that parent doesn't already exist), but it still leaves the requirement of creating the other two directories and the index.html file (again, this is not particularly arduous but feels like it should be unnecessary).



Ideally I'd like that the command mkdir <projectName> when run in the /var/www directory would create the <projectName> directory with the css, img, js directories and the index.html document (that document ideally containing the skeleton of a valid html document*). However I accept that abusing the mkdir command would likely lead to unforeseen/predictable edge-cases and consequences, so probably the best compromise is a script of some kind.



With the above in mind, I created the following (naive/simple) script:



#!/bin/bash
mkdir $@
cd $@
mkdir css img js
touch index.html


I call the above script as follows:



./createDir.sh projectName


This works but is less than ideal; the problems:



  1. the created index.html has a type of plain text document (text/plain), rather than the expected HTML document (text/html), and of course

  2. has none of the structure of an HTML document (as outlined in the single footnote), because I didn't add any content (and haven't yet found a way of creating said content in a script).

Also, somewhat predictably, both the css and js directories would also – ideally – be created with documents (project.css and project.js) intact.



So, is there a means by which I can create – with the use of a script, or otherwise – a directory with its subdirectories and documents?




*. As a rudimentary example:



<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="js/project.js"></script>
<link href="css/project.css" rel="stylesheet" />
</head>
<body></body>
</html>






share|improve this question



















  • Related: Create file and its parent directory
    – steeldriver
    2 hours ago










  • what is wrong with mkdir -p projectName/css,js,img? Plus you can add a && touch projectName/index.html to create the file, or use a cp to copy a index.html to this location.
    – Rinzwind
    2 hours ago











  • @Rinzwind: absolutely nothing is wrong with it, except that I hadn't come across that syntax before and didn't know of its existence. I do like - and hadn't considered - the approach of copying existing template files. Thank you.
    – David Thomas
    2 hours ago











  • @DavidThomas well you can also create the file on the fly by doing a "echo content > index.html" ;)
    – Rinzwind
    2 hours ago






  • 1




    I would just like to point out that creating a user with adduser does something similar. For that purpose skeleton is used, which is in fact a template like proposed in some answers. If you make a template/skeleton with all directories and files, the only thing you need is copy (cp -fvr <template> <destination>) after creating a directory for a new project.
    – nobody
    2 hours ago













up vote
0
down vote

favorite









up vote
0
down vote

favorite











For web-development practice I'm using a LAMP stack, on Ubuntu 17.10. For this I'm creating directories within /var/www, each directory is named after a project.



To create a subdirectory I use the terminal and:



david@Ed:/var/www/html$ mkdir projectName
david@Ed:/var/www/html$ cd projectName
david@Ed:/var/www/html/projectName$ mkdir css img js
david@Ed:/var/www/html/projectName$ touch index.html
david@Ed:/var/www/html/projectName$ ls
css img index.html js


This works. And, in all honesty, is far from arduous. But, is there a means by which I can simplify this?



I'm aware that:



mkdir -p projectName/css


Will create both the css, and the parent projectName, directory (if that parent doesn't already exist), but it still leaves the requirement of creating the other two directories and the index.html file (again, this is not particularly arduous but feels like it should be unnecessary).



Ideally I'd like that the command mkdir <projectName> when run in the /var/www directory would create the <projectName> directory with the css, img, js directories and the index.html document (that document ideally containing the skeleton of a valid html document*). However I accept that abusing the mkdir command would likely lead to unforeseen/predictable edge-cases and consequences, so probably the best compromise is a script of some kind.



With the above in mind, I created the following (naive/simple) script:



#!/bin/bash
mkdir $@
cd $@
mkdir css img js
touch index.html


I call the above script as follows:



./createDir.sh projectName


This works but is less than ideal; the problems:



  1. the created index.html has a type of plain text document (text/plain), rather than the expected HTML document (text/html), and of course

  2. has none of the structure of an HTML document (as outlined in the single footnote), because I didn't add any content (and haven't yet found a way of creating said content in a script).

Also, somewhat predictably, both the css and js directories would also – ideally – be created with documents (project.css and project.js) intact.



So, is there a means by which I can create – with the use of a script, or otherwise – a directory with its subdirectories and documents?




*. As a rudimentary example:



<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="js/project.js"></script>
<link href="css/project.css" rel="stylesheet" />
</head>
<body></body>
</html>






share|improve this question











For web-development practice I'm using a LAMP stack, on Ubuntu 17.10. For this I'm creating directories within /var/www, each directory is named after a project.



To create a subdirectory I use the terminal and:



david@Ed:/var/www/html$ mkdir projectName
david@Ed:/var/www/html$ cd projectName
david@Ed:/var/www/html/projectName$ mkdir css img js
david@Ed:/var/www/html/projectName$ touch index.html
david@Ed:/var/www/html/projectName$ ls
css img index.html js


This works. And, in all honesty, is far from arduous. But, is there a means by which I can simplify this?



I'm aware that:



mkdir -p projectName/css


Will create both the css, and the parent projectName, directory (if that parent doesn't already exist), but it still leaves the requirement of creating the other two directories and the index.html file (again, this is not particularly arduous but feels like it should be unnecessary).



Ideally I'd like that the command mkdir <projectName> when run in the /var/www directory would create the <projectName> directory with the css, img, js directories and the index.html document (that document ideally containing the skeleton of a valid html document*). However I accept that abusing the mkdir command would likely lead to unforeseen/predictable edge-cases and consequences, so probably the best compromise is a script of some kind.



With the above in mind, I created the following (naive/simple) script:



#!/bin/bash
mkdir $@
cd $@
mkdir css img js
touch index.html


I call the above script as follows:



./createDir.sh projectName


This works but is less than ideal; the problems:



  1. the created index.html has a type of plain text document (text/plain), rather than the expected HTML document (text/html), and of course

  2. has none of the structure of an HTML document (as outlined in the single footnote), because I didn't add any content (and haven't yet found a way of creating said content in a script).

Also, somewhat predictably, both the css and js directories would also – ideally – be created with documents (project.css and project.js) intact.



So, is there a means by which I can create – with the use of a script, or otherwise – a directory with its subdirectories and documents?




*. As a rudimentary example:



<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="js/project.js"></script>
<link href="css/project.css" rel="stylesheet" />
</head>
<body></body>
</html>








share|improve this question










share|improve this question




share|improve this question









asked 3 hours ago









David Thomas

4601615




4601615











  • Related: Create file and its parent directory
    – steeldriver
    2 hours ago










  • what is wrong with mkdir -p projectName/css,js,img? Plus you can add a && touch projectName/index.html to create the file, or use a cp to copy a index.html to this location.
    – Rinzwind
    2 hours ago











  • @Rinzwind: absolutely nothing is wrong with it, except that I hadn't come across that syntax before and didn't know of its existence. I do like - and hadn't considered - the approach of copying existing template files. Thank you.
    – David Thomas
    2 hours ago











  • @DavidThomas well you can also create the file on the fly by doing a "echo content > index.html" ;)
    – Rinzwind
    2 hours ago






  • 1




    I would just like to point out that creating a user with adduser does something similar. For that purpose skeleton is used, which is in fact a template like proposed in some answers. If you make a template/skeleton with all directories and files, the only thing you need is copy (cp -fvr <template> <destination>) after creating a directory for a new project.
    – nobody
    2 hours ago

















  • Related: Create file and its parent directory
    – steeldriver
    2 hours ago










  • what is wrong with mkdir -p projectName/css,js,img? Plus you can add a && touch projectName/index.html to create the file, or use a cp to copy a index.html to this location.
    – Rinzwind
    2 hours ago











  • @Rinzwind: absolutely nothing is wrong with it, except that I hadn't come across that syntax before and didn't know of its existence. I do like - and hadn't considered - the approach of copying existing template files. Thank you.
    – David Thomas
    2 hours ago











  • @DavidThomas well you can also create the file on the fly by doing a "echo content > index.html" ;)
    – Rinzwind
    2 hours ago






  • 1




    I would just like to point out that creating a user with adduser does something similar. For that purpose skeleton is used, which is in fact a template like proposed in some answers. If you make a template/skeleton with all directories and files, the only thing you need is copy (cp -fvr <template> <destination>) after creating a directory for a new project.
    – nobody
    2 hours ago
















Related: Create file and its parent directory
– steeldriver
2 hours ago




Related: Create file and its parent directory
– steeldriver
2 hours ago












what is wrong with mkdir -p projectName/css,js,img? Plus you can add a && touch projectName/index.html to create the file, or use a cp to copy a index.html to this location.
– Rinzwind
2 hours ago





what is wrong with mkdir -p projectName/css,js,img? Plus you can add a && touch projectName/index.html to create the file, or use a cp to copy a index.html to this location.
– Rinzwind
2 hours ago













@Rinzwind: absolutely nothing is wrong with it, except that I hadn't come across that syntax before and didn't know of its existence. I do like - and hadn't considered - the approach of copying existing template files. Thank you.
– David Thomas
2 hours ago





@Rinzwind: absolutely nothing is wrong with it, except that I hadn't come across that syntax before and didn't know of its existence. I do like - and hadn't considered - the approach of copying existing template files. Thank you.
– David Thomas
2 hours ago













@DavidThomas well you can also create the file on the fly by doing a "echo content > index.html" ;)
– Rinzwind
2 hours ago




@DavidThomas well you can also create the file on the fly by doing a "echo content > index.html" ;)
– Rinzwind
2 hours ago




1




1




I would just like to point out that creating a user with adduser does something similar. For that purpose skeleton is used, which is in fact a template like proposed in some answers. If you make a template/skeleton with all directories and files, the only thing you need is copy (cp -fvr <template> <destination>) after creating a directory for a new project.
– nobody
2 hours ago





I would just like to point out that creating a user with adduser does something similar. For that purpose skeleton is used, which is in fact a template like proposed in some answers. If you make a template/skeleton with all directories and files, the only thing you need is copy (cp -fvr <template> <destination>) after creating a directory for a new project.
– nobody
2 hours ago











2 Answers
2






active

oldest

votes

















up vote
0
down vote













While this is an imperfect answer, and is mostly produced via some further searches after I posted the question, I've updated my script and solved most of the the problems.



My current script (equally naive and simple though it certainly is) is:



#!/bin/bash
mkdir $@
cd $@
mkdir css img js
cat > index.html <<- "EOF"
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="js/project.js"></script>
<link href="css/project.css" rel="stylesheet" />
</head>
<body></body>
</html>
EOF
cat > css/project.css <<- "EOF"
*, ::before, ::after
margin: 0;
padding: 0;
box-sizing: border-box;

EOF
cat > js/project.js <<- "EOF"
;
EOF


This feels a little dirty, though it does work. The main issue with this, current, approach is that final cat call:



cat > js/project.js <<- "EOF"
;
EOF


This to produce a document that is correctly identified by its type property as application/javascript, whereas using:



touch js/project.js


Simply creates yet another document – with the correct filetype extension – whose type attribute is plain text document (text/plain).






share|improve this answer




























    up vote
    0
    down vote













    You'll need some template for your index.html to copy from. But you can create such a template on the fly and then copy it to the desired destination. The install command may be of help:



    #!/usr/bin/env bash

    template=$(mktemp); # creates a temporary file, usually in /tmp

    # Add the HTML code to that temporary file:
    cat << EOF > $template
    <!DOCTYPE html>
    <html>
    <head>
    <title></title>
    <script src="js/project.js"></script>
    <link href="css/project.css" rel="stylesheet" />
    </head>
    <body></body>
    </html>
    EOF

    # "Install" the file with the given mode
    # and create any intermediate directories:
    install -m 0644 -D $template /var/www/html/projectName/index.html

    # remove the temporary file
    rm $template;

    exit 0;


    You probably need to run this script via sudo because /var/... isn't world-writable.






    share|improve this answer





















      Your Answer







      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "89"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: true,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );








       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1062388%2fis-there-a-way-to-create-a-new-directory-containing-subdirectories-and-document%23new-answer', 'question_page');

      );

      Post as a guest






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      0
      down vote













      While this is an imperfect answer, and is mostly produced via some further searches after I posted the question, I've updated my script and solved most of the the problems.



      My current script (equally naive and simple though it certainly is) is:



      #!/bin/bash
      mkdir $@
      cd $@
      mkdir css img js
      cat > index.html <<- "EOF"
      <!DOCTYPE html>
      <html>
      <head>
      <title></title>
      <script src="js/project.js"></script>
      <link href="css/project.css" rel="stylesheet" />
      </head>
      <body></body>
      </html>
      EOF
      cat > css/project.css <<- "EOF"
      *, ::before, ::after
      margin: 0;
      padding: 0;
      box-sizing: border-box;

      EOF
      cat > js/project.js <<- "EOF"
      ;
      EOF


      This feels a little dirty, though it does work. The main issue with this, current, approach is that final cat call:



      cat > js/project.js <<- "EOF"
      ;
      EOF


      This to produce a document that is correctly identified by its type property as application/javascript, whereas using:



      touch js/project.js


      Simply creates yet another document – with the correct filetype extension – whose type attribute is plain text document (text/plain).






      share|improve this answer

























        up vote
        0
        down vote













        While this is an imperfect answer, and is mostly produced via some further searches after I posted the question, I've updated my script and solved most of the the problems.



        My current script (equally naive and simple though it certainly is) is:



        #!/bin/bash
        mkdir $@
        cd $@
        mkdir css img js
        cat > index.html <<- "EOF"
        <!DOCTYPE html>
        <html>
        <head>
        <title></title>
        <script src="js/project.js"></script>
        <link href="css/project.css" rel="stylesheet" />
        </head>
        <body></body>
        </html>
        EOF
        cat > css/project.css <<- "EOF"
        *, ::before, ::after
        margin: 0;
        padding: 0;
        box-sizing: border-box;

        EOF
        cat > js/project.js <<- "EOF"
        ;
        EOF


        This feels a little dirty, though it does work. The main issue with this, current, approach is that final cat call:



        cat > js/project.js <<- "EOF"
        ;
        EOF


        This to produce a document that is correctly identified by its type property as application/javascript, whereas using:



        touch js/project.js


        Simply creates yet another document – with the correct filetype extension – whose type attribute is plain text document (text/plain).






        share|improve this answer























          up vote
          0
          down vote










          up vote
          0
          down vote









          While this is an imperfect answer, and is mostly produced via some further searches after I posted the question, I've updated my script and solved most of the the problems.



          My current script (equally naive and simple though it certainly is) is:



          #!/bin/bash
          mkdir $@
          cd $@
          mkdir css img js
          cat > index.html <<- "EOF"
          <!DOCTYPE html>
          <html>
          <head>
          <title></title>
          <script src="js/project.js"></script>
          <link href="css/project.css" rel="stylesheet" />
          </head>
          <body></body>
          </html>
          EOF
          cat > css/project.css <<- "EOF"
          *, ::before, ::after
          margin: 0;
          padding: 0;
          box-sizing: border-box;

          EOF
          cat > js/project.js <<- "EOF"
          ;
          EOF


          This feels a little dirty, though it does work. The main issue with this, current, approach is that final cat call:



          cat > js/project.js <<- "EOF"
          ;
          EOF


          This to produce a document that is correctly identified by its type property as application/javascript, whereas using:



          touch js/project.js


          Simply creates yet another document – with the correct filetype extension – whose type attribute is plain text document (text/plain).






          share|improve this answer













          While this is an imperfect answer, and is mostly produced via some further searches after I posted the question, I've updated my script and solved most of the the problems.



          My current script (equally naive and simple though it certainly is) is:



          #!/bin/bash
          mkdir $@
          cd $@
          mkdir css img js
          cat > index.html <<- "EOF"
          <!DOCTYPE html>
          <html>
          <head>
          <title></title>
          <script src="js/project.js"></script>
          <link href="css/project.css" rel="stylesheet" />
          </head>
          <body></body>
          </html>
          EOF
          cat > css/project.css <<- "EOF"
          *, ::before, ::after
          margin: 0;
          padding: 0;
          box-sizing: border-box;

          EOF
          cat > js/project.js <<- "EOF"
          ;
          EOF


          This feels a little dirty, though it does work. The main issue with this, current, approach is that final cat call:



          cat > js/project.js <<- "EOF"
          ;
          EOF


          This to produce a document that is correctly identified by its type property as application/javascript, whereas using:



          touch js/project.js


          Simply creates yet another document – with the correct filetype extension – whose type attribute is plain text document (text/plain).







          share|improve this answer













          share|improve this answer



          share|improve this answer











          answered 2 hours ago









          David Thomas

          4601615




          4601615






















              up vote
              0
              down vote













              You'll need some template for your index.html to copy from. But you can create such a template on the fly and then copy it to the desired destination. The install command may be of help:



              #!/usr/bin/env bash

              template=$(mktemp); # creates a temporary file, usually in /tmp

              # Add the HTML code to that temporary file:
              cat << EOF > $template
              <!DOCTYPE html>
              <html>
              <head>
              <title></title>
              <script src="js/project.js"></script>
              <link href="css/project.css" rel="stylesheet" />
              </head>
              <body></body>
              </html>
              EOF

              # "Install" the file with the given mode
              # and create any intermediate directories:
              install -m 0644 -D $template /var/www/html/projectName/index.html

              # remove the temporary file
              rm $template;

              exit 0;


              You probably need to run this script via sudo because /var/... isn't world-writable.






              share|improve this answer

























                up vote
                0
                down vote













                You'll need some template for your index.html to copy from. But you can create such a template on the fly and then copy it to the desired destination. The install command may be of help:



                #!/usr/bin/env bash

                template=$(mktemp); # creates a temporary file, usually in /tmp

                # Add the HTML code to that temporary file:
                cat << EOF > $template
                <!DOCTYPE html>
                <html>
                <head>
                <title></title>
                <script src="js/project.js"></script>
                <link href="css/project.css" rel="stylesheet" />
                </head>
                <body></body>
                </html>
                EOF

                # "Install" the file with the given mode
                # and create any intermediate directories:
                install -m 0644 -D $template /var/www/html/projectName/index.html

                # remove the temporary file
                rm $template;

                exit 0;


                You probably need to run this script via sudo because /var/... isn't world-writable.






                share|improve this answer























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  You'll need some template for your index.html to copy from. But you can create such a template on the fly and then copy it to the desired destination. The install command may be of help:



                  #!/usr/bin/env bash

                  template=$(mktemp); # creates a temporary file, usually in /tmp

                  # Add the HTML code to that temporary file:
                  cat << EOF > $template
                  <!DOCTYPE html>
                  <html>
                  <head>
                  <title></title>
                  <script src="js/project.js"></script>
                  <link href="css/project.css" rel="stylesheet" />
                  </head>
                  <body></body>
                  </html>
                  EOF

                  # "Install" the file with the given mode
                  # and create any intermediate directories:
                  install -m 0644 -D $template /var/www/html/projectName/index.html

                  # remove the temporary file
                  rm $template;

                  exit 0;


                  You probably need to run this script via sudo because /var/... isn't world-writable.






                  share|improve this answer













                  You'll need some template for your index.html to copy from. But you can create such a template on the fly and then copy it to the desired destination. The install command may be of help:



                  #!/usr/bin/env bash

                  template=$(mktemp); # creates a temporary file, usually in /tmp

                  # Add the HTML code to that temporary file:
                  cat << EOF > $template
                  <!DOCTYPE html>
                  <html>
                  <head>
                  <title></title>
                  <script src="js/project.js"></script>
                  <link href="css/project.css" rel="stylesheet" />
                  </head>
                  <body></body>
                  </html>
                  EOF

                  # "Install" the file with the given mode
                  # and create any intermediate directories:
                  install -m 0644 -D $template /var/www/html/projectName/index.html

                  # remove the temporary file
                  rm $template;

                  exit 0;


                  You probably need to run this script via sudo because /var/... isn't world-writable.







                  share|improve this answer













                  share|improve this answer



                  share|improve this answer











                  answered 2 hours ago









                  PerlDuck

                  3,0101726




                  3,0101726






















                       

                      draft saved


                      draft discarded


























                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1062388%2fis-there-a-way-to-create-a-new-directory-containing-subdirectories-and-document%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Popular posts from this blog

                      How do so many people here on Academia.SE, and in general, afford lavish higher education programs?

                      Trouble downloading packages list due to a “Hash sum mismatch” error

                      How do I move numbers in filenames, in a batch renaming operation?