Directory tree listing, script does not work in csh?

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












ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^/]*//--/g' -e 's/^/ /' -e 's/-/|/'


I found a command to display directory tree (see above), it didn't work correctly. It gave error message "Illegal variable name". I think the error is at $ sign. How can I modify this command for cshell environment?







share|improve this question

















  • 1




    Other than escaping it?
    – Ignacio Vazquez-Abrams
    Jul 30 at 8:04






  • 1




    I suspect that I am not the only one enjoying that the answer is given only a few characters further along in the question itself.
    – JdeBP
    Jul 30 at 8:38










  • What is “directory command”?
    – ctrl-alt-delor
    Jul 30 at 9:08
















up vote
0
down vote

favorite












ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^/]*//--/g' -e 's/^/ /' -e 's/-/|/'


I found a command to display directory tree (see above), it didn't work correctly. It gave error message "Illegal variable name". I think the error is at $ sign. How can I modify this command for cshell environment?







share|improve this question

















  • 1




    Other than escaping it?
    – Ignacio Vazquez-Abrams
    Jul 30 at 8:04






  • 1




    I suspect that I am not the only one enjoying that the answer is given only a few characters further along in the question itself.
    – JdeBP
    Jul 30 at 8:38










  • What is “directory command”?
    – ctrl-alt-delor
    Jul 30 at 9:08












up vote
0
down vote

favorite









up vote
0
down vote

favorite











ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^/]*//--/g' -e 's/^/ /' -e 's/-/|/'


I found a command to display directory tree (see above), it didn't work correctly. It gave error message "Illegal variable name". I think the error is at $ sign. How can I modify this command for cshell environment?







share|improve this question













ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^/]*//--/g' -e 's/^/ /' -e 's/-/|/'


I found a command to display directory tree (see above), it didn't work correctly. It gave error message "Illegal variable name". I think the error is at $ sign. How can I modify this command for cshell environment?









share|improve this question












share|improve this question




share|improve this question








edited Jul 30 at 17:58









Jeff Schaller

30.7k846104




30.7k846104









asked Jul 30 at 8:01









Trong Nhan Nguyen

172




172







  • 1




    Other than escaping it?
    – Ignacio Vazquez-Abrams
    Jul 30 at 8:04






  • 1




    I suspect that I am not the only one enjoying that the answer is given only a few characters further along in the question itself.
    – JdeBP
    Jul 30 at 8:38










  • What is “directory command”?
    – ctrl-alt-delor
    Jul 30 at 9:08












  • 1




    Other than escaping it?
    – Ignacio Vazquez-Abrams
    Jul 30 at 8:04






  • 1




    I suspect that I am not the only one enjoying that the answer is given only a few characters further along in the question itself.
    – JdeBP
    Jul 30 at 8:38










  • What is “directory command”?
    – ctrl-alt-delor
    Jul 30 at 9:08







1




1




Other than escaping it?
– Ignacio Vazquez-Abrams
Jul 30 at 8:04




Other than escaping it?
– Ignacio Vazquez-Abrams
Jul 30 at 8:04




1




1




I suspect that I am not the only one enjoying that the answer is given only a few characters further along in the question itself.
– JdeBP
Jul 30 at 8:38




I suspect that I am not the only one enjoying that the answer is given only a few characters further along in the question itself.
– JdeBP
Jul 30 at 8:38












What is “directory command”?
– ctrl-alt-delor
Jul 30 at 9:08




What is “directory command”?
– ctrl-alt-delor
Jul 30 at 9:08










2 Answers
2






active

oldest

votes

















up vote
1
down vote













:$ should be in single quotes to stop the shell from expanding it.



so ls -R | grep ':$' | sed -e 's/:$//' -e 's/[^-][^/]*//--/g' -e 's/^/ /' -e 's/-/|/'




Your next thing to learn, is shell quoting, and expansions.



Also a lot of people consider csh to have been a mistake. It is full of odd inconsistent behaviour. Consider another bash, ksh, fish …






share|improve this answer




























    up vote
    1
    down vote













    Instead of a shell script you can use an external commands. 'tree' may be available in your environment, then it's easy.



    tree -d





    share|improve this answer























      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',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      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%2funix.stackexchange.com%2fquestions%2f459277%2fdirectory-tree-listing-script-does-not-work-in-csh%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
      1
      down vote













      :$ should be in single quotes to stop the shell from expanding it.



      so ls -R | grep ':$' | sed -e 's/:$//' -e 's/[^-][^/]*//--/g' -e 's/^/ /' -e 's/-/|/'




      Your next thing to learn, is shell quoting, and expansions.



      Also a lot of people consider csh to have been a mistake. It is full of odd inconsistent behaviour. Consider another bash, ksh, fish …






      share|improve this answer

























        up vote
        1
        down vote













        :$ should be in single quotes to stop the shell from expanding it.



        so ls -R | grep ':$' | sed -e 's/:$//' -e 's/[^-][^/]*//--/g' -e 's/^/ /' -e 's/-/|/'




        Your next thing to learn, is shell quoting, and expansions.



        Also a lot of people consider csh to have been a mistake. It is full of odd inconsistent behaviour. Consider another bash, ksh, fish …






        share|improve this answer























          up vote
          1
          down vote










          up vote
          1
          down vote









          :$ should be in single quotes to stop the shell from expanding it.



          so ls -R | grep ':$' | sed -e 's/:$//' -e 's/[^-][^/]*//--/g' -e 's/^/ /' -e 's/-/|/'




          Your next thing to learn, is shell quoting, and expansions.



          Also a lot of people consider csh to have been a mistake. It is full of odd inconsistent behaviour. Consider another bash, ksh, fish …






          share|improve this answer













          :$ should be in single quotes to stop the shell from expanding it.



          so ls -R | grep ':$' | sed -e 's/:$//' -e 's/[^-][^/]*//--/g' -e 's/^/ /' -e 's/-/|/'




          Your next thing to learn, is shell quoting, and expansions.



          Also a lot of people consider csh to have been a mistake. It is full of odd inconsistent behaviour. Consider another bash, ksh, fish …







          share|improve this answer













          share|improve this answer



          share|improve this answer











          answered Jul 30 at 9:12









          ctrl-alt-delor

          8,54031946




          8,54031946






















              up vote
              1
              down vote













              Instead of a shell script you can use an external commands. 'tree' may be available in your environment, then it's easy.



              tree -d





              share|improve this answer



























                up vote
                1
                down vote













                Instead of a shell script you can use an external commands. 'tree' may be available in your environment, then it's easy.



                tree -d





                share|improve this answer

























                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote









                  Instead of a shell script you can use an external commands. 'tree' may be available in your environment, then it's easy.



                  tree -d





                  share|improve this answer















                  Instead of a shell script you can use an external commands. 'tree' may be available in your environment, then it's easy.



                  tree -d






                  share|improve this answer















                  share|improve this answer



                  share|improve this answer








                  edited Jul 30 at 9:20









                  ctrl-alt-delor

                  8,54031946




                  8,54031946











                  answered Jul 30 at 9:17









                  redseven

                  1876




                  1876






















                       

                      draft saved


                      draft discarded


























                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f459277%2fdirectory-tree-listing-script-does-not-work-in-csh%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Popular posts from this blog

                      Peggy Mitchell

                      Palaiologos

                      The Forum (Inglewood, California)