0

I currently having a problem in which I am trying to read read/monitor the content of a list of files which is stored in text file.

Problem with my current approach is that leads to all the files being opened in nano, rather than giving me the option, whether I want to delete the entry or not.. (last part not implemented yet..)

The text file is stored like this

Aline
Bline
Cline
Dline
Eline

What I am currently doing is:

cat file |  while read line; do nano "$line"; done

which rather opening one file at time, opens all the files at the same time.

Solution?

13
  • 1
    That command is syntactically incorrect, please post the actual command/script you're using.
    – muru
    Apr 3, 2018 at 7:51
  • 2
    you need another semicolon, or the shell is going to wait for done
    – Zanna
    Apr 3, 2018 at 7:54
  • 1
    What do you want to achieve in the end? Why would you want to open single lines in nano? Do you need to edit them? If so, what should happen with the edited lines? If not, there's no need to use nano to just view them.
    – Byte Commander
    Apr 3, 2018 at 8:05
  • 1
    That still doesn't show the behaviour described (nano complains about stdin and the whole thing just fails.)
    – muru
    Apr 3, 2018 at 8:06
  • 2
    @ByteCommander presumably each line of the file is the name of a file...
    – Zanna
    Apr 3, 2018 at 8:09

1 Answer 1

1

zenity is a handy tool for quick dialog boxes:

keep=()
while read -r filename; do
    zenity --text-info --title="$filename" --filename="$filename" \
           --ok-label=Keep --cancel-label=Remove
    if [[ $? -eq 0 ]]; then
        keep+=("$filename")
    fi
done < file_of_filenames
printf "%s\n" "${keep[@]}" > file_of_filenames

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .