What happens when you run the following commands directly in your shell:
where somefile is the name of some file that you can edit? If this didn't work for you when run outside of a script, what makes you think it should work when you run it inside a script?
As I said in post #12 in this thread:
Quote:
How is it that you expect to edit a file when your editor is running in the background and can't read editing instructions from the terminal?
Jobs run in the background are blocked if they try to read from or write to their controlling terminal. The wait command that you are executing is not reporting that gedit terminated; it is reporting that gedit was stopped (probably by a SIGTTOU or SIGTTIN signal).
Maybe issuing the following command line in a shell would be instructive:
This User Gave Thanks to Don Cragun For This Post:
.
.
.
How is it that you expect to edit a file when your editor is running in the background and can't read editing instructions from the terminal?
.
.
.
I can't speak for gedit, but leafpad, be it sent to background or not, opens a new window with an editing session.
Sorry, I didn't really understand what you meant. When running those commands in the terminal this was the result:
So it works properly there? I'm totally new to this though so I don't understand why something like that wouldn't work in a .sh script?
---------- Post updated at 01:20 PM ---------- Previous update was at 01:17 PM ----------
Quote:
Originally Posted by Corona688
Have you tried my suggestion of not putting gedit in the background at all?
I'm sorry the reason I've not done this is I don't know how? Any further help would be greatly appreciated.
I didn't need to close the file or anything - whereas when I use a different system I normally have to CTRL+C or something to use the terminal once I've used it to open a file. Just noticed this now.
I can't speak for gedit, but leafpad, be it sent to background or not, opens a new window with an editing session.
OK. I don't have leafpad or gedit on my system. When testing with vi (note that in post #10, the O.P. said that gedit and vi were used interchangeably), by running the command line:
I immediately get:
and about 10 seconds later I get:
noting that vi is stopped; not terminated. And about 10 seconds later, the fg $PID brings vi somefile into the foreground so I can edit somefile. When I quit vi, I then get a new shell prompt for another command.
Hello Experts,
I need to write a shell script to check if a file is open and something is being written to it. I want to know how OS handles it. I checked with lsof command but it is not working. For a test I did this.
while true; do echo `date` >>abc.txt; done
then I checked
lsof |... (5 Replies)
Hi,
I am facing a problem regarding .csv file, my script does not read .csv file and if i open this file in vi editor and perform :wq option then only my script reads the .csv file.
Thanks (5 Replies)
vi: syntax error at line 1: `)' unexpected
when I try to vi into the /etc/vfstab, the return gives me the above error.
how can resolve this so that I can have access into vi. (6 Replies)
Hi,
I would like to ask about the notepad++ text editor application, Although there are alternative and more great text editor in linux (gedit, geany, jedit) im still using the notepad++ sometimes cause for some of my own reason one of those is the minimalist text(what i mean is notepad++ has a... (2 Replies)
I know how to check if any file has a unix process using a file by looking at 'lsof <fullpath/filename>' command.
I think using lsof is very expensive. Also to make it accurate we need to inlcude fullpath of the file.
Is there another command that can tell if a file has a truely active... (12 Replies)
Hi Everyone,
# cat a.txt
94,aqqc,62345907,
5,aeec,77,
# cat 1.pl
#!/usr/bin/perl
use strict;
use warnings;
use Date::Manip;
open(my $FA, "/root/a.txt") or die "$!";
while(<$FA>) {
chomp;
my @tmp=split(/\,/, $_);
if (index($tmp, "qq") ne -1) {
... (4 Replies)
i have following query
e.g i want the VI Editor cursor at line number N instead of 0 while opening the file from unix prompt.
vi filename ??????
Can anyone help? (4 Replies)
helo
I install my product for koren language
I m uisng RHEL -4 operating system
now problem is whenever I open any file
vi filename
I got following error on the screen
E557: Cannot open termcap file
'vt100' not known. Available builtin terminals are:
builtin_ansi
... (1 Reply)
Hi all,
I have a shell script that i started editing, only in the midst of which i tried to save the changes i found that the file wasnt been provided with write/execute permissions.
I later have redone the changes and saved the file-
Just curious to know if there was any command wherein... (5 Replies)
Hi,
I unable to open any file using Vi editor,constantly getting the following error,
vi log.log
*** glibc detected *** malloc(): memory corruption: 0x081af510 **
uname -a
Linux sekac092 2.6.5-7.244-bigsmp #1 SMP Mon Dec 12 18:32:25 UTC 2005 i686 athlon i386 GNU/Linux
Also Note
ls... (8 Replies)