Bash Scripting: Menu from file
I have a file called list.txt with on word on each line that changes in length. I'd like to make a menu, each line being its own choice. I pieced together most of it the only thing missing is a failsafe for typing a number out of range. Any ideas?
Code:
#!/bin/bash |
First of all, $(..) is highly recommended over `..`.
Second, awk can take a filename as an input argument, so you don't need to use cat and a pipe. And if there's only one word per line, then you don't need $1. Code:
awk '{print}' list.txt Code:
Code:
#!/bin/bash |
Pseudo code:
Code:
a=wc -l filename |
All times are GMT -5. The time now is 05:28 PM. |