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
Terminal: line of code to ask user to select name from a list?
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="Tarn_Williamson" data-source="post: 1764000" data-attributes="member: 394193"><p>Hi all,</p><p>In my script I use the ls command to display the list of files in the directory. I then want the user to choose and input a single file name from the list (using the read command). If they enter a name not listed above I want the terminal to ask them to retype. The files in the directory are not always going to be the same every time the script is run, so the script will have to somehow compare the user input to all files in that directory at that current time. Can I compare input to ls somehow?</p><p></p><p>Thank you in advance</p><p>(P.s. I'm new to this <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" /> )</p></blockquote><p></p>
[QUOTE="Tarn_Williamson, post: 1764000, member: 394193"] Hi all, In my script I use the ls command to display the list of files in the directory. I then want the user to choose and input a single file name from the list (using the read command). If they enter a name not listed above I want the terminal to ask them to retype. The files in the directory are not always going to be the same every time the script is run, so the script will have to somehow compare the user input to all files in that directory at that current time. Can I compare input to ls somehow? Thank you in advance (P.s. I'm new to this :) ) [/QUOTE]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Terminal: line of code to ask user to select name from a list?
Top