Nano in a while loop

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
0
down vote

favorite












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?










share|improve this question



















  • 1




    That command is syntactically incorrect, please post the actual command/script you're using.
    – muru
    Apr 3 at 7:51






  • 2




    you need another semicolon, or the shell is going to wait for done
    – Zanna
    Apr 3 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 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 at 8:06






  • 2




    @ByteCommander presumably each line of the file is the name of a file...
    – Zanna
    Apr 3 at 8:09














up vote
0
down vote

favorite












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?










share|improve this question



















  • 1




    That command is syntactically incorrect, please post the actual command/script you're using.
    – muru
    Apr 3 at 7:51






  • 2




    you need another semicolon, or the shell is going to wait for done
    – Zanna
    Apr 3 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 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 at 8:06






  • 2




    @ByteCommander presumably each line of the file is the name of a file...
    – Zanna
    Apr 3 at 8:09












up vote
0
down vote

favorite









up vote
0
down vote

favorite











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?










share|improve this question















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?







command-line bash gnome-terminal nano






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 3 at 11:58

























asked Apr 3 at 7:46









asd

11




11







  • 1




    That command is syntactically incorrect, please post the actual command/script you're using.
    – muru
    Apr 3 at 7:51






  • 2




    you need another semicolon, or the shell is going to wait for done
    – Zanna
    Apr 3 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 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 at 8:06






  • 2




    @ByteCommander presumably each line of the file is the name of a file...
    – Zanna
    Apr 3 at 8:09












  • 1




    That command is syntactically incorrect, please post the actual command/script you're using.
    – muru
    Apr 3 at 7:51






  • 2




    you need another semicolon, or the shell is going to wait for done
    – Zanna
    Apr 3 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 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 at 8:06






  • 2




    @ByteCommander presumably each line of the file is the name of a file...
    – Zanna
    Apr 3 at 8:09







1




1




That command is syntactically incorrect, please post the actual command/script you're using.
– muru
Apr 3 at 7:51




That command is syntactically incorrect, please post the actual command/script you're using.
– muru
Apr 3 at 7:51




2




2




you need another semicolon, or the shell is going to wait for done
– Zanna
Apr 3 at 7:54




you need another semicolon, or the shell is going to wait for done
– Zanna
Apr 3 at 7:54




1




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 at 8:05




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 at 8:05




1




1




That still doesn't show the behaviour described (nano complains about stdin and the whole thing just fails.)
– muru
Apr 3 at 8:06




That still doesn't show the behaviour described (nano complains about stdin and the whole thing just fails.)
– muru
Apr 3 at 8:06




2




2




@ByteCommander presumably each line of the file is the name of a file...
– Zanna
Apr 3 at 8:09




@ByteCommander presumably each line of the file is the name of a file...
– Zanna
Apr 3 at 8:09










1 Answer
1






active

oldest

votes

















up vote
1
down vote













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 "%sn" "$keep[@]" > file_of_filenames





share|improve this answer






















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "89"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1021521%2fnano-in-a-while-loop%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    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 "%sn" "$keep[@]" > file_of_filenames





    share|improve this answer


























      up vote
      1
      down vote













      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 "%sn" "$keep[@]" > file_of_filenames





      share|improve this answer
























        up vote
        1
        down vote










        up vote
        1
        down vote









        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 "%sn" "$keep[@]" > file_of_filenames





        share|improve this answer














        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 "%sn" "$keep[@]" > file_of_filenames






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Apr 3 at 11:57

























        answered Apr 3 at 11:49









        glenn jackman

        12k2442




        12k2442



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1021521%2fnano-in-a-while-loop%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            Trouble downloading packages list due to a “Hash sum mismatch” error

            How do so many people here on Academia.SE, and in general, afford lavish higher education programs?

            Cutting all the characters after the last /