SlideShare une entreprise Scribd logo
1  sur  1
[C] Print of paths of all directories within a directory
Given a directory ./a that contains subdirectories and files for example:
iteratively get all the directory paths like "dog/", "dog/akl/", "dog/qwd/" iteratively
Solution
#!/bin/sh ####################################################### # UNIX TREE #
Version: 2.3 # File: ~/apps/tree/tree.sh # # Displays Structure of Directory Hierarchy # ------------
------------------------------------- # This tiny script uses "ls", "grep", and "sed" # in a single
command to show the nesting of # sub-directories. The setup command for PATH # works with
the Bash shell (the Mac OS X default). # # Setup: # $ cd ~/apps/tree # $ chmod u+x tree.sh # $ ln
-s ~/apps/tree/tree.sh ~/bin/tree # $ echo "PATH=~/bin:${PATH}" >> ~/.profile # # Usage: #
$ tree [directory] # # Examples: # $ tree # $ tree /etc/opt # $ tree .. # # Public Domain Software -
- Free to Use as You Like # http://www.centerkey.com/tree - By Dem Pilafian
####################################################### echo if [ "$1" != "" ] #if
parameter exists, use as base folder then cd "$1" fi pwd ls -R | grep ":$" |  sed -e 's/:$//' -e
's/[^-][^/]*//--/g' -e 's/^/ /' -e 's/-/|/' # 1st sed: remove colons # 2nd sed: replace higher level
folder names with dashes # 3rd sed: indent graph three spaces # 4th sed: replace first dash with a
vertical bar if [ `ls -F -1 | grep "/" | wc -l` = 0 ] # check if no folders then echo " -> no sub-
directories" fi echo exit

Contenu connexe

Similaire à -C- Print of paths of all directories within a directory Given a direc.docx

Introduction to the linux command line.pdf
Introduction to the linux command line.pdfIntroduction to the linux command line.pdf
Introduction to the linux command line.pdfCesleySCruz
 
101 3.1 gnu and unix commands
101 3.1 gnu and unix commands101 3.1 gnu and unix commands
101 3.1 gnu and unix commandsAcácio Oliveira
 
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformaticsBITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformaticsBITS
 
390aLecture05_12sp.ppt
390aLecture05_12sp.ppt390aLecture05_12sp.ppt
390aLecture05_12sp.pptmugeshmsd5
 
(Ebook) linux shell scripting tutorial
(Ebook) linux shell scripting tutorial(Ebook) linux shell scripting tutorial
(Ebook) linux shell scripting tutorialjayaramprabhu
 
RHCSA EX200 - Summary
RHCSA EX200 - SummaryRHCSA EX200 - Summary
RHCSA EX200 - SummaryNugroho Gito
 
Really useful linux commands
Really useful linux commandsReally useful linux commands
Really useful linux commandsMichael J Geiser
 
Introduction to Linux
Introduction to Linux Introduction to Linux
Introduction to Linux Harish R
 
Bash Shell Introduction By Arun Bagul
Bash Shell Introduction  By Arun BagulBash Shell Introduction  By Arun Bagul
Bash Shell Introduction By Arun BagulArun Bagul
 
33269198 all-commands-in-ms-dos(1)
33269198 all-commands-in-ms-dos(1)33269198 all-commands-in-ms-dos(1)
33269198 all-commands-in-ms-dos(1)A.S.M Shmimul Islam.
 
basic shell scripting syntex
basic shell scripting syntexbasic shell scripting syntex
basic shell scripting syntexKsd Che
 
Shell-Scripting-1.pdf
Shell-Scripting-1.pdfShell-Scripting-1.pdf
Shell-Scripting-1.pdfaznabi
 

Similaire à -C- Print of paths of all directories within a directory Given a direc.docx (20)

Introduction to the linux command line.pdf
Introduction to the linux command line.pdfIntroduction to the linux command line.pdf
Introduction to the linux command line.pdf
 
101 3.1 gnu and unix commands
101 3.1 gnu and unix commands101 3.1 gnu and unix commands
101 3.1 gnu and unix commands
 
Slides
SlidesSlides
Slides
 
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformaticsBITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
 
390aLecture05_12sp.ppt
390aLecture05_12sp.ppt390aLecture05_12sp.ppt
390aLecture05_12sp.ppt
 
21bUc8YeDzZpE
21bUc8YeDzZpE21bUc8YeDzZpE
21bUc8YeDzZpE
 
21bUc8YeDzZpE
21bUc8YeDzZpE21bUc8YeDzZpE
21bUc8YeDzZpE
 
21bUc8YeDzZpE
21bUc8YeDzZpE21bUc8YeDzZpE
21bUc8YeDzZpE
 
(Ebook) linux shell scripting tutorial
(Ebook) linux shell scripting tutorial(Ebook) linux shell scripting tutorial
(Ebook) linux shell scripting tutorial
 
UnixShells.ppt
UnixShells.pptUnixShells.ppt
UnixShells.ppt
 
RHCSA EX200 - Summary
RHCSA EX200 - SummaryRHCSA EX200 - Summary
RHCSA EX200 - Summary
 
Really useful linux commands
Really useful linux commandsReally useful linux commands
Really useful linux commands
 
Introduction to Linux
Introduction to Linux Introduction to Linux
Introduction to Linux
 
Bash Shell Introduction By Arun Bagul
Bash Shell Introduction  By Arun BagulBash Shell Introduction  By Arun Bagul
Bash Shell Introduction By Arun Bagul
 
Directories description
Directories descriptionDirectories description
Directories description
 
33269198 all-commands-in-ms-dos(1)
33269198 all-commands-in-ms-dos(1)33269198 all-commands-in-ms-dos(1)
33269198 all-commands-in-ms-dos(1)
 
33269198 all-commands-in-ms-dos
33269198 all-commands-in-ms-dos33269198 all-commands-in-ms-dos
33269198 all-commands-in-ms-dos
 
basic shell scripting syntex
basic shell scripting syntexbasic shell scripting syntex
basic shell scripting syntex
 
Shell-Scripting-1.pdf
Shell-Scripting-1.pdfShell-Scripting-1.pdf
Shell-Scripting-1.pdf
 
SHELL PROGRAMMING
SHELL PROGRAMMINGSHELL PROGRAMMING
SHELL PROGRAMMING
 

Plus de dorisc7

(TCO 2) Which of the following project management activities is associ.docx
(TCO 2) Which of the following project management activities is associ.docx(TCO 2) Which of the following project management activities is associ.docx
(TCO 2) Which of the following project management activities is associ.docxdorisc7
 
(TCO 1) Who are the users of managerial accounting information- How do.docx
(TCO 1) Who are the users of managerial accounting information- How do.docx(TCO 1) Who are the users of managerial accounting information- How do.docx
(TCO 1) Who are the users of managerial accounting information- How do.docxdorisc7
 
(Subsequent events) Green- CPA- is auditing the financial statements o.docx
(Subsequent events) Green- CPA- is auditing the financial statements o.docx(Subsequent events) Green- CPA- is auditing the financial statements o.docx
(Subsequent events) Green- CPA- is auditing the financial statements o.docxdorisc7
 
(Reliability engineering) Make a list of six population stereotypical.docx
(Reliability engineering) Make a list of six population stereotypical.docx(Reliability engineering) Make a list of six population stereotypical.docx
(Reliability engineering) Make a list of six population stereotypical.docxdorisc7
 
(JAVA NetBeans) Write a Java program able to perform selection sort-So.docx
(JAVA NetBeans) Write a Java program able to perform selection sort-So.docx(JAVA NetBeans) Write a Java program able to perform selection sort-So.docx
(JAVA NetBeans) Write a Java program able to perform selection sort-So.docxdorisc7
 
-Java programming- Write a class named Junior-java Inherits the Stud.docx
-Java programming-  Write a class named Junior-java  Inherits the Stud.docx-Java programming-  Write a class named Junior-java  Inherits the Stud.docx
-Java programming- Write a class named Junior-java Inherits the Stud.docxdorisc7
 
--Social Organizations and Core Competencies-- Please respond to the f.docx
--Social Organizations and Core Competencies-- Please respond to the f.docx--Social Organizations and Core Competencies-- Please respond to the f.docx
--Social Organizations and Core Competencies-- Please respond to the f.docxdorisc7
 
-- I have two classes One is Carnivore and the other is Herbivore- Eac.docx
-- I have two classes One is Carnivore and the other is Herbivore- Eac.docx-- I have two classes One is Carnivore and the other is Herbivore- Eac.docx
-- I have two classes One is Carnivore and the other is Herbivore- Eac.docxdorisc7
 
- Answer the following questions about acids 1- What is the phase of a.docx
- Answer the following questions about acids 1- What is the phase of a.docx- Answer the following questions about acids 1- What is the phase of a.docx
- Answer the following questions about acids 1- What is the phase of a.docxdorisc7
 
- At time 110 four processes (P1 P4) are waiting for a timeout signal.docx
- At time 110 four processes (P1  P4) are waiting for a timeout signal.docx- At time 110 four processes (P1  P4) are waiting for a timeout signal.docx
- At time 110 four processes (P1 P4) are waiting for a timeout signal.docxdorisc7
 
(70 pts) Nuclear History Identify the event in nuclear history that oc.docx
(70 pts) Nuclear History Identify the event in nuclear history that oc.docx(70 pts) Nuclear History Identify the event in nuclear history that oc.docx
(70 pts) Nuclear History Identify the event in nuclear history that oc.docxdorisc7
 
(2) The CPU incorporates several major components (as shown in Fig- de.docx
(2) The CPU incorporates several major components (as shown in Fig- de.docx(2) The CPU incorporates several major components (as shown in Fig- de.docx
(2) The CPU incorporates several major components (as shown in Fig- de.docxdorisc7
 
(Audit evidence) The third GAAS of field work requires that the audito.docx
(Audit evidence) The third GAAS of field work requires that the audito.docx(Audit evidence) The third GAAS of field work requires that the audito.docx
(Audit evidence) The third GAAS of field work requires that the audito.docxdorisc7
 
What is the Big Bang-SolutionBig Bang is a theory which talks ababo th.docx
What is the Big Bang-SolutionBig Bang is a theory which talks ababo th.docxWhat is the Big Bang-SolutionBig Bang is a theory which talks ababo th.docx
What is the Big Bang-SolutionBig Bang is a theory which talks ababo th.docxdorisc7
 
What is the concept of sustainable income- Please describe it in your.docx
What is the concept of sustainable income- Please describe it in your.docxWhat is the concept of sustainable income- Please describe it in your.docx
What is the concept of sustainable income- Please describe it in your.docxdorisc7
 
What is the backbone for the Internet- Briefly describe how the Intern.docx
What is the backbone for the Internet- Briefly describe how the Intern.docxWhat is the backbone for the Internet- Briefly describe how the Intern.docx
What is the backbone for the Internet- Briefly describe how the Intern.docxdorisc7
 
What is the pH of a 0-1 M aqueous solution of NaH2PO4SolutionNaH2PO4 -.docx
What is the pH of a 0-1 M aqueous solution of NaH2PO4SolutionNaH2PO4 -.docxWhat is the pH of a 0-1 M aqueous solution of NaH2PO4SolutionNaH2PO4 -.docx
What is the pH of a 0-1 M aqueous solution of NaH2PO4SolutionNaH2PO4 -.docxdorisc7
 
what is the ph of a 0-16M NaF(aq) solution-SolutionNaF(aq) -----------.docx
what is the ph of a 0-16M NaF(aq) solution-SolutionNaF(aq) -----------.docxwhat is the ph of a 0-16M NaF(aq) solution-SolutionNaF(aq) -----------.docx
what is the ph of a 0-16M NaF(aq) solution-SolutionNaF(aq) -----------.docxdorisc7
 
What is the pH of a 0-114 M solution of the acid HA if its ionization (1).docx
What is the pH of a 0-114 M solution of the acid HA if its ionization (1).docxWhat is the pH of a 0-114 M solution of the acid HA if its ionization (1).docx
What is the pH of a 0-114 M solution of the acid HA if its ionization (1).docxdorisc7
 
What is the minimum number of nodes in an AVL tree of height 8- Let N(.docx
What is the minimum number of nodes in an AVL tree of height 8- Let N(.docxWhat is the minimum number of nodes in an AVL tree of height 8- Let N(.docx
What is the minimum number of nodes in an AVL tree of height 8- Let N(.docxdorisc7
 

Plus de dorisc7 (20)

(TCO 2) Which of the following project management activities is associ.docx
(TCO 2) Which of the following project management activities is associ.docx(TCO 2) Which of the following project management activities is associ.docx
(TCO 2) Which of the following project management activities is associ.docx
 
(TCO 1) Who are the users of managerial accounting information- How do.docx
(TCO 1) Who are the users of managerial accounting information- How do.docx(TCO 1) Who are the users of managerial accounting information- How do.docx
(TCO 1) Who are the users of managerial accounting information- How do.docx
 
(Subsequent events) Green- CPA- is auditing the financial statements o.docx
(Subsequent events) Green- CPA- is auditing the financial statements o.docx(Subsequent events) Green- CPA- is auditing the financial statements o.docx
(Subsequent events) Green- CPA- is auditing the financial statements o.docx
 
(Reliability engineering) Make a list of six population stereotypical.docx
(Reliability engineering) Make a list of six population stereotypical.docx(Reliability engineering) Make a list of six population stereotypical.docx
(Reliability engineering) Make a list of six population stereotypical.docx
 
(JAVA NetBeans) Write a Java program able to perform selection sort-So.docx
(JAVA NetBeans) Write a Java program able to perform selection sort-So.docx(JAVA NetBeans) Write a Java program able to perform selection sort-So.docx
(JAVA NetBeans) Write a Java program able to perform selection sort-So.docx
 
-Java programming- Write a class named Junior-java Inherits the Stud.docx
-Java programming-  Write a class named Junior-java  Inherits the Stud.docx-Java programming-  Write a class named Junior-java  Inherits the Stud.docx
-Java programming- Write a class named Junior-java Inherits the Stud.docx
 
--Social Organizations and Core Competencies-- Please respond to the f.docx
--Social Organizations and Core Competencies-- Please respond to the f.docx--Social Organizations and Core Competencies-- Please respond to the f.docx
--Social Organizations and Core Competencies-- Please respond to the f.docx
 
-- I have two classes One is Carnivore and the other is Herbivore- Eac.docx
-- I have two classes One is Carnivore and the other is Herbivore- Eac.docx-- I have two classes One is Carnivore and the other is Herbivore- Eac.docx
-- I have two classes One is Carnivore and the other is Herbivore- Eac.docx
 
- Answer the following questions about acids 1- What is the phase of a.docx
- Answer the following questions about acids 1- What is the phase of a.docx- Answer the following questions about acids 1- What is the phase of a.docx
- Answer the following questions about acids 1- What is the phase of a.docx
 
- At time 110 four processes (P1 P4) are waiting for a timeout signal.docx
- At time 110 four processes (P1  P4) are waiting for a timeout signal.docx- At time 110 four processes (P1  P4) are waiting for a timeout signal.docx
- At time 110 four processes (P1 P4) are waiting for a timeout signal.docx
 
(70 pts) Nuclear History Identify the event in nuclear history that oc.docx
(70 pts) Nuclear History Identify the event in nuclear history that oc.docx(70 pts) Nuclear History Identify the event in nuclear history that oc.docx
(70 pts) Nuclear History Identify the event in nuclear history that oc.docx
 
(2) The CPU incorporates several major components (as shown in Fig- de.docx
(2) The CPU incorporates several major components (as shown in Fig- de.docx(2) The CPU incorporates several major components (as shown in Fig- de.docx
(2) The CPU incorporates several major components (as shown in Fig- de.docx
 
(Audit evidence) The third GAAS of field work requires that the audito.docx
(Audit evidence) The third GAAS of field work requires that the audito.docx(Audit evidence) The third GAAS of field work requires that the audito.docx
(Audit evidence) The third GAAS of field work requires that the audito.docx
 
What is the Big Bang-SolutionBig Bang is a theory which talks ababo th.docx
What is the Big Bang-SolutionBig Bang is a theory which talks ababo th.docxWhat is the Big Bang-SolutionBig Bang is a theory which talks ababo th.docx
What is the Big Bang-SolutionBig Bang is a theory which talks ababo th.docx
 
What is the concept of sustainable income- Please describe it in your.docx
What is the concept of sustainable income- Please describe it in your.docxWhat is the concept of sustainable income- Please describe it in your.docx
What is the concept of sustainable income- Please describe it in your.docx
 
What is the backbone for the Internet- Briefly describe how the Intern.docx
What is the backbone for the Internet- Briefly describe how the Intern.docxWhat is the backbone for the Internet- Briefly describe how the Intern.docx
What is the backbone for the Internet- Briefly describe how the Intern.docx
 
What is the pH of a 0-1 M aqueous solution of NaH2PO4SolutionNaH2PO4 -.docx
What is the pH of a 0-1 M aqueous solution of NaH2PO4SolutionNaH2PO4 -.docxWhat is the pH of a 0-1 M aqueous solution of NaH2PO4SolutionNaH2PO4 -.docx
What is the pH of a 0-1 M aqueous solution of NaH2PO4SolutionNaH2PO4 -.docx
 
what is the ph of a 0-16M NaF(aq) solution-SolutionNaF(aq) -----------.docx
what is the ph of a 0-16M NaF(aq) solution-SolutionNaF(aq) -----------.docxwhat is the ph of a 0-16M NaF(aq) solution-SolutionNaF(aq) -----------.docx
what is the ph of a 0-16M NaF(aq) solution-SolutionNaF(aq) -----------.docx
 
What is the pH of a 0-114 M solution of the acid HA if its ionization (1).docx
What is the pH of a 0-114 M solution of the acid HA if its ionization (1).docxWhat is the pH of a 0-114 M solution of the acid HA if its ionization (1).docx
What is the pH of a 0-114 M solution of the acid HA if its ionization (1).docx
 
What is the minimum number of nodes in an AVL tree of height 8- Let N(.docx
What is the minimum number of nodes in an AVL tree of height 8- Let N(.docxWhat is the minimum number of nodes in an AVL tree of height 8- Let N(.docx
What is the minimum number of nodes in an AVL tree of height 8- Let N(.docx
 

Dernier

Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 

Dernier (20)

Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 

-C- Print of paths of all directories within a directory Given a direc.docx

  • 1. [C] Print of paths of all directories within a directory Given a directory ./a that contains subdirectories and files for example: iteratively get all the directory paths like "dog/", "dog/akl/", "dog/qwd/" iteratively Solution #!/bin/sh ####################################################### # UNIX TREE # Version: 2.3 # File: ~/apps/tree/tree.sh # # Displays Structure of Directory Hierarchy # ------------ ------------------------------------- # This tiny script uses "ls", "grep", and "sed" # in a single command to show the nesting of # sub-directories. The setup command for PATH # works with the Bash shell (the Mac OS X default). # # Setup: # $ cd ~/apps/tree # $ chmod u+x tree.sh # $ ln -s ~/apps/tree/tree.sh ~/bin/tree # $ echo "PATH=~/bin:${PATH}" >> ~/.profile # # Usage: # $ tree [directory] # # Examples: # $ tree # $ tree /etc/opt # $ tree .. # # Public Domain Software - - Free to Use as You Like # http://www.centerkey.com/tree - By Dem Pilafian ####################################################### echo if [ "$1" != "" ] #if parameter exists, use as base folder then cd "$1" fi pwd ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^/]*//--/g' -e 's/^/ /' -e 's/-/|/' # 1st sed: remove colons # 2nd sed: replace higher level folder names with dashes # 3rd sed: indent graph three spaces # 4th sed: replace first dash with a vertical bar if [ `ls -F -1 | grep "/" | wc -l` = 0 ] # check if no folders then echo " -> no sub- directories" fi echo exit