Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Shell script question
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Niwrad" data-source="post: 127186"><p>So basically if we want the whole path we need a script that executes something like the following series of commands:</p><p></p><p>For "/export/home/niward/direct1/direct2/file"</p><p></p><p>ls -l file > file_info</p><p>ls -ld >> file_info</p><p>cd ..</p><p>ls -ld >> file_info</p><p>cd ..</p><p>ls -ld >> file_info</p><p>cd ..</p><p>etc..........</p><p></p><p>This loop seems like it might work, and you can run the loop until[ -e ../ ] is false. Will it work?</p><p></p><p>I know how to do loop "checks", but don't know how to loop a command yet, anyone know how to do this? If so, what is the general form?</p></blockquote><p></p>
[QUOTE="Niwrad, post: 127186"] So basically if we want the whole path we need a script that executes something like the following series of commands: For "/export/home/niward/direct1/direct2/file" ls -l file > file_info ls -ld >> file_info cd .. ls -ld >> file_info cd .. ls -ld >> file_info cd .. etc.......... This loop seems like it might work, and you can run the loop until[ -e ../ ] is false. Will it work? I know how to do loop "checks", but don't know how to loop a command yet, anyone know how to do this? If so, what is the general form? [/QUOTE]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Shell script question
Top