V
V
VN2021-08-12 11:22:22
bash
VN, 2021-08-12 11:22:22

How to auto-select to enter the path to the file in the bash script?

Tell me how to make auto-selection to enter the path to the file in the script.

The read command is executed which needs to be fed the path to the file. As an example, this script

#!/bin/bash
 
echo "Enter the file path."
read file
filesize=”$(stat -c %s $file)
echo "$file is precise $filesize bytes."

The path to the file can be very long, and typing it in the blind is somehow not very good...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
VN, 2021-08-12
@kavabangaungava

Figured it out myself
-e
If the standard input is coming from a terminal, Readline is used
to obtain the line.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question