Nano in a while loop

Clash 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?
command-line bash gnome-terminal nano
 |Â
show 8 more comments
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?
command-line bash gnome-terminal nano
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 fordone
â 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 (nanocomplains 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
 |Â
show 8 more comments
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?
command-line bash gnome-terminal nano
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
command-line bash gnome-terminal nano
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 fordone
â 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 (nanocomplains 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
 |Â
show 8 more comments
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 fordone
â 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 (nanocomplains 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
 |Â
show 8 more comments
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
add a comment |Â
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
add a comment |Â
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
add a comment |Â
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
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
edited Apr 3 at 11:57
answered Apr 3 at 11:49
glenn jackman
12k2442
12k2442
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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 (
nanocomplains 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