Finding a specific icons theme somewhere to cd for using sed to replace and add in all SVG file in multiple...












0














In the continuation of Using sed to replace the hexadecimal code for URL and to insert new SVG codes after SVG tag in all SVG files, I would like to find an icons theme somewhere to cd and then to replace and add/insert in all SVG files in multiple specific folders.



Taking the codes from the file replace.sh from the link above. I am not sure if my bash/shell codes are bad and inelegant in your eyes.



Here is my complete code:




  1. Firstly begins the function go_dir_to_breeze. You can see the conditions in the end of code, in the which it will locate the existent icons theme somewhere. If it is found, you will enter in the function go_dir_to_breeze and begin the item (2).

  2. After found successfully, you are entering in the funciton change_colour(), which will begin the sed to replace and string, calling foo.pl, but instead, it will hear to the variable of the chosen colour/gradient in the conditions before beginning to call $. If the colour/gradient is found, it will begin to callfoo.pl` to replace and insert.


For example:



echo "Which type of colour do you prefer? Write the nummber"
echo "1) solid 2) gradient"
read type

if [$type = "1"]; then
echo "Write one of these colours to choose your favourite:"
echo "black gold greenn grey orange purplen red yellow"
read color
else
echo "Write one of these letters to choose your favourite gradient:"
echo "a) telinkrin b) arrogrin c) minoan"
read color
fi

go_dir_to_breeze()
{

change_colour()
{
for f in *svg; do
case "$color" in
a)
perl gradient1.pl "$f" > tmpFile && mv tmpFile "$f"
;;
b)
perl gradient2.pl "$f" > tmpFile && mv tmpFile "$f"
;;
c)
perl gradient3.pl "$f" > tmpFile && mv tmpFile "$f"
;;
black)
perl black.pl "$f" > tmpFile && mv tmpFile "$f"
;;
gold)
perl gold.pl "$f" > tmpFile && mv tmpFile "$f"
;;
green)
perl green.pl "$f" > tmpFile && mv tmpFile "$f"
;;
grey)
perl grey.pl "$f" > tmpFile && mv tmpFile "$f"
;;
orange)
perl orangle.pl "$f" > tmpFile && mv tmpFile "$f"
;;
purple)
perl purple.pl "$f" > tmpFile && mv tmpFile "$f"
;;
red)
perl red.pl "$f" > tmpFile && mv tmpFile "$f"
;;
esac
done
}

cd apps='apps/16'
change_colour
cd ..

cd places='places/16'
change_colour
cd ..

cd mimetypes='mimetypes/16'
change_colour

}

if [ find /home/$USER/.icons/breeze ]; then
go_dir_to_breeze
elif [ find /home/$USER/local/share/icons/breeze ]; then
go_dir_to_breeze
# Observe that to change the colour of icons, it is required to run as root
elif [ find /usr/share/icons/breeze ]; then
go_dir_to_breeze
else
echo "Icons theme Breeze does not exist!"
fi








share







New contributor




Gustavo Reis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0














    In the continuation of Using sed to replace the hexadecimal code for URL and to insert new SVG codes after SVG tag in all SVG files, I would like to find an icons theme somewhere to cd and then to replace and add/insert in all SVG files in multiple specific folders.



    Taking the codes from the file replace.sh from the link above. I am not sure if my bash/shell codes are bad and inelegant in your eyes.



    Here is my complete code:




    1. Firstly begins the function go_dir_to_breeze. You can see the conditions in the end of code, in the which it will locate the existent icons theme somewhere. If it is found, you will enter in the function go_dir_to_breeze and begin the item (2).

    2. After found successfully, you are entering in the funciton change_colour(), which will begin the sed to replace and string, calling foo.pl, but instead, it will hear to the variable of the chosen colour/gradient in the conditions before beginning to call $. If the colour/gradient is found, it will begin to callfoo.pl` to replace and insert.


    For example:



    echo "Which type of colour do you prefer? Write the nummber"
    echo "1) solid 2) gradient"
    read type

    if [$type = "1"]; then
    echo "Write one of these colours to choose your favourite:"
    echo "black gold greenn grey orange purplen red yellow"
    read color
    else
    echo "Write one of these letters to choose your favourite gradient:"
    echo "a) telinkrin b) arrogrin c) minoan"
    read color
    fi

    go_dir_to_breeze()
    {

    change_colour()
    {
    for f in *svg; do
    case "$color" in
    a)
    perl gradient1.pl "$f" > tmpFile && mv tmpFile "$f"
    ;;
    b)
    perl gradient2.pl "$f" > tmpFile && mv tmpFile "$f"
    ;;
    c)
    perl gradient3.pl "$f" > tmpFile && mv tmpFile "$f"
    ;;
    black)
    perl black.pl "$f" > tmpFile && mv tmpFile "$f"
    ;;
    gold)
    perl gold.pl "$f" > tmpFile && mv tmpFile "$f"
    ;;
    green)
    perl green.pl "$f" > tmpFile && mv tmpFile "$f"
    ;;
    grey)
    perl grey.pl "$f" > tmpFile && mv tmpFile "$f"
    ;;
    orange)
    perl orangle.pl "$f" > tmpFile && mv tmpFile "$f"
    ;;
    purple)
    perl purple.pl "$f" > tmpFile && mv tmpFile "$f"
    ;;
    red)
    perl red.pl "$f" > tmpFile && mv tmpFile "$f"
    ;;
    esac
    done
    }

    cd apps='apps/16'
    change_colour
    cd ..

    cd places='places/16'
    change_colour
    cd ..

    cd mimetypes='mimetypes/16'
    change_colour

    }

    if [ find /home/$USER/.icons/breeze ]; then
    go_dir_to_breeze
    elif [ find /home/$USER/local/share/icons/breeze ]; then
    go_dir_to_breeze
    # Observe that to change the colour of icons, it is required to run as root
    elif [ find /usr/share/icons/breeze ]; then
    go_dir_to_breeze
    else
    echo "Icons theme Breeze does not exist!"
    fi








    share







    New contributor




    Gustavo Reis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0







      In the continuation of Using sed to replace the hexadecimal code for URL and to insert new SVG codes after SVG tag in all SVG files, I would like to find an icons theme somewhere to cd and then to replace and add/insert in all SVG files in multiple specific folders.



      Taking the codes from the file replace.sh from the link above. I am not sure if my bash/shell codes are bad and inelegant in your eyes.



      Here is my complete code:




      1. Firstly begins the function go_dir_to_breeze. You can see the conditions in the end of code, in the which it will locate the existent icons theme somewhere. If it is found, you will enter in the function go_dir_to_breeze and begin the item (2).

      2. After found successfully, you are entering in the funciton change_colour(), which will begin the sed to replace and string, calling foo.pl, but instead, it will hear to the variable of the chosen colour/gradient in the conditions before beginning to call $. If the colour/gradient is found, it will begin to callfoo.pl` to replace and insert.


      For example:



      echo "Which type of colour do you prefer? Write the nummber"
      echo "1) solid 2) gradient"
      read type

      if [$type = "1"]; then
      echo "Write one of these colours to choose your favourite:"
      echo "black gold greenn grey orange purplen red yellow"
      read color
      else
      echo "Write one of these letters to choose your favourite gradient:"
      echo "a) telinkrin b) arrogrin c) minoan"
      read color
      fi

      go_dir_to_breeze()
      {

      change_colour()
      {
      for f in *svg; do
      case "$color" in
      a)
      perl gradient1.pl "$f" > tmpFile && mv tmpFile "$f"
      ;;
      b)
      perl gradient2.pl "$f" > tmpFile && mv tmpFile "$f"
      ;;
      c)
      perl gradient3.pl "$f" > tmpFile && mv tmpFile "$f"
      ;;
      black)
      perl black.pl "$f" > tmpFile && mv tmpFile "$f"
      ;;
      gold)
      perl gold.pl "$f" > tmpFile && mv tmpFile "$f"
      ;;
      green)
      perl green.pl "$f" > tmpFile && mv tmpFile "$f"
      ;;
      grey)
      perl grey.pl "$f" > tmpFile && mv tmpFile "$f"
      ;;
      orange)
      perl orangle.pl "$f" > tmpFile && mv tmpFile "$f"
      ;;
      purple)
      perl purple.pl "$f" > tmpFile && mv tmpFile "$f"
      ;;
      red)
      perl red.pl "$f" > tmpFile && mv tmpFile "$f"
      ;;
      esac
      done
      }

      cd apps='apps/16'
      change_colour
      cd ..

      cd places='places/16'
      change_colour
      cd ..

      cd mimetypes='mimetypes/16'
      change_colour

      }

      if [ find /home/$USER/.icons/breeze ]; then
      go_dir_to_breeze
      elif [ find /home/$USER/local/share/icons/breeze ]; then
      go_dir_to_breeze
      # Observe that to change the colour of icons, it is required to run as root
      elif [ find /usr/share/icons/breeze ]; then
      go_dir_to_breeze
      else
      echo "Icons theme Breeze does not exist!"
      fi








      share







      New contributor




      Gustavo Reis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      In the continuation of Using sed to replace the hexadecimal code for URL and to insert new SVG codes after SVG tag in all SVG files, I would like to find an icons theme somewhere to cd and then to replace and add/insert in all SVG files in multiple specific folders.



      Taking the codes from the file replace.sh from the link above. I am not sure if my bash/shell codes are bad and inelegant in your eyes.



      Here is my complete code:




      1. Firstly begins the function go_dir_to_breeze. You can see the conditions in the end of code, in the which it will locate the existent icons theme somewhere. If it is found, you will enter in the function go_dir_to_breeze and begin the item (2).

      2. After found successfully, you are entering in the funciton change_colour(), which will begin the sed to replace and string, calling foo.pl, but instead, it will hear to the variable of the chosen colour/gradient in the conditions before beginning to call $. If the colour/gradient is found, it will begin to callfoo.pl` to replace and insert.


      For example:



      echo "Which type of colour do you prefer? Write the nummber"
      echo "1) solid 2) gradient"
      read type

      if [$type = "1"]; then
      echo "Write one of these colours to choose your favourite:"
      echo "black gold greenn grey orange purplen red yellow"
      read color
      else
      echo "Write one of these letters to choose your favourite gradient:"
      echo "a) telinkrin b) arrogrin c) minoan"
      read color
      fi

      go_dir_to_breeze()
      {

      change_colour()
      {
      for f in *svg; do
      case "$color" in
      a)
      perl gradient1.pl "$f" > tmpFile && mv tmpFile "$f"
      ;;
      b)
      perl gradient2.pl "$f" > tmpFile && mv tmpFile "$f"
      ;;
      c)
      perl gradient3.pl "$f" > tmpFile && mv tmpFile "$f"
      ;;
      black)
      perl black.pl "$f" > tmpFile && mv tmpFile "$f"
      ;;
      gold)
      perl gold.pl "$f" > tmpFile && mv tmpFile "$f"
      ;;
      green)
      perl green.pl "$f" > tmpFile && mv tmpFile "$f"
      ;;
      grey)
      perl grey.pl "$f" > tmpFile && mv tmpFile "$f"
      ;;
      orange)
      perl orangle.pl "$f" > tmpFile && mv tmpFile "$f"
      ;;
      purple)
      perl purple.pl "$f" > tmpFile && mv tmpFile "$f"
      ;;
      red)
      perl red.pl "$f" > tmpFile && mv tmpFile "$f"
      ;;
      esac
      done
      }

      cd apps='apps/16'
      change_colour
      cd ..

      cd places='places/16'
      change_colour
      cd ..

      cd mimetypes='mimetypes/16'
      change_colour

      }

      if [ find /home/$USER/.icons/breeze ]; then
      go_dir_to_breeze
      elif [ find /home/$USER/local/share/icons/breeze ]; then
      go_dir_to_breeze
      # Observe that to change the colour of icons, it is required to run as root
      elif [ find /usr/share/icons/breeze ]; then
      go_dir_to_breeze
      else
      echo "Icons theme Breeze does not exist!"
      fi






      bash shell-script sed perl





      share







      New contributor




      Gustavo Reis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      Gustavo Reis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      Gustavo Reis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 4 mins ago









      Gustavo Reis

      83




      83




      New contributor




      Gustavo Reis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Gustavo Reis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Gustavo Reis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          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',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          Gustavo Reis is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f492755%2ffinding-a-specific-icons-theme-somewhere-to-cd-for-using-sed-to-replace-and-add%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          Gustavo Reis is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          Gustavo Reis is a new contributor. Be nice, and check out our Code of Conduct.













          Gustavo Reis is a new contributor. Be nice, and check out our Code of Conduct.












          Gustavo Reis is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f492755%2ffinding-a-specific-icons-theme-somewhere-to-cd-for-using-sed-to-replace-and-add%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          濃尾地震

          How to rewrite equation of hyperbola in standard form

          No ethernet ip address in my vocore2