LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-08-2013, 09:54 PM   #16
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,516

Rep: Reputation: 2893Reputation: 2893Reputation: 2893Reputation: 2893Reputation: 2893Reputation: 2893Reputation: 2893Reputation: 2893Reputation: 2893Reputation: 2893Reputation: 2893

Hi towheedm, yes I realise asked by you, my point is it needs to be asked by the person entering the command line
 
Old 03-09-2013, 08:31 AM   #17
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,702

Rep: Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270
Quote:
Originally Posted by sunil80 View Post
hello everyone,
In past days, sometimes by mistake i run the command,
"cat > /etc/passwd" and it get clear when i press CTRL+Z, CTRL+C or CTRL+D.

Can I exit this command without changing my file.
No.

The problem is that bash opens the file /etc/passwd with the truncate as part of the "> /etc/passwd" handling before the command ("cat") is even executed. What happens after bash opens the file, is that it is passed to the "cat" utility as stdout.

Terminating the command by ctrl-c (interrupt) or ctrl-d (end of file), just closes the file - leaving it with nothing in it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
KDE4: saving programs, positions and window settings on exit snoopy1 Linux - Software 2 05-28-2009 12:37 PM
How to exit and save (or just to exit) inside a "make config" running command? scrat75 Linux - Kernel 6 09-05-2008 04:02 PM
Saving open webpages on exit Maverick1182 Linux - Software 3 10-08-2006 02:29 PM
Kde 3 not saving configuration on exit Raduprv Linux - Software 2 12-06-2003 10:52 PM
exit without saving KaktusKnight Linux - Newbie 1 02-10-2003 02:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration