Thursday, May 3, 2012

[Level 1] autocomplete in shell script

#!/bin/bash
read -e -p 'input file name ( for auto complete): ' input_file
echo $input_file
$ ./autocomplete.sh
input file name ( for auto complete): /etc/ho<tab>
input file name ( for auto complete): /etc/host<enter>
/etc/host
$

Wish this helps.

regards,
Stanley Huang