As the subject states, I am re-writing the ls -F command in C++, but I am having trouble adding some of the Formatting characters to the files names. Here is my code:
It is adding the correct formatting character ("/") for directories, but not for my executable files such as "a.out" and "paige_sh" which should have an asterick (*). Here is a sample run:
Hi
I am very new to Linux programming,otherwise I have exposure to Linux. Was thinking about something like writing my own commands for Linux. Any ideas where to start, any useful links and what I need to know before I start with this.
Thanks :)
Sidhu (3 Replies)
Hello All;
I am going to write an application in C/C++ which has so many source files and hence created
many subdirectories. My area of concern is to write makefile. What i thought that each
subdirectory would have own makefile and wanted to have one parent makefile which will call all ... (3 Replies)
Hi,
Is it possible to accept a filename as command line parameter and then write to that file using command redirection? i tried the below script.
outputfile=`echo $1`
echo "Writing to file" > 'echo $outputfile'
exit $returncode
but it isnt working. is there any other way to... (9 Replies)
I developed a script in Lingon (which is an automated script editor developed for OS X) that is used to automatically restart programs only if they crash. The script itself does just that, but I only want it to load if I'm going to use the specific application that it's designed to protect. In... (3 Replies)
I developed a script in Lingon (which is an automated script editor developed for OS X) that is used to automatically restart programs only if they crash. The script itself does just that, but I only want it to load if I'm going to use the specific application that it's designed to protect. In the... (2 Replies)
cmd='date | wc' or cmd="date | wc"
$cmdIf this script is executed, an error is generated. The reason written was that "The execution fails because the pipe is not expanded and is passed to date as an argument". What is meant by expansion of pipe. When we execute date | wc on the command line, it... (2 Replies)
Dear Madam/Sir
Who can help me with writing a script doing the following?
1- Read names of files (only files with special name format let say initially they have the same file name start like TT*)
2- Then create an empty files with the same names have been read in step one but with extension... (1 Reply)
I am looking to do a ls on a folder and have the output of the ls be structured so that is is modificaiton date, file name with the date in a format that is compatible with mysql. I am trying to build a table that stores the last modification date of certain files so I can display it on some web... (4 Replies)
Dear All,
I have a question that's been difficult to get an answer to.
I often write command line loops, e.g. find files, print name, grep for term, apply sed, etc
I use both zsh and bash.
When I write a loop e.g.
for line in `more myfile.txt`
> do
> echo $line
> done
but... (2 Replies)
I have a script called script.sh that has the following in it.
cat /home/auto/script.sh
#!/bin/bash
ARGA=$1
if ; then
echo "${ARGA}:Confirmed"
else
echo "${ARGA}:Unconfirmed"
fi
I need a way to run this script, and then, after script has confirmed the... (9 Replies)
Discussion started by: SkySmart
9 Replies
LEARN ABOUT DEBIAN
bgerror
bgerror(3tcl) Tcl Built-In Commands bgerror(3tcl)__________________________________________________________________________________________________________________________________________________NAME
bgerror - Command invoked to process background errors
SYNOPSIS
bgerror message
_________________________________________________________________DESCRIPTION
Release 8.5 of Tcl supports the interp bgerror command, which allows applications to register in an interpreter the command that will han- |
dle background errors in that interpreter. In older releases of Tcl, this level of control was not available, and applications could con- |
trol the handling of background errors only by creating a command with the particular command name bgerror in the global namespace of an |
interpreter. The following documentation describes the interface requirements of the bgerror command an application might define to retain |
compatibility with pre-8.5 releases of Tcl. Applications intending to support only Tcl releases 8.5 and later should simply make use of |
interp bgerror.
The bgerror command does not exist as built-in part of Tcl. Instead, individual applications or users can define a bgerror command (e.g.
as a Tcl procedure) if they wish to handle background errors.
A background error is one that occurs in an event handler or some other command that did not originate with the application. For example,
if an error occurs while executing a command specified with the after command, then it is a background error. For a non-background error,
the error can simply be returned up through nested Tcl command evaluations until it reaches the top-level code in the application; then the
application can report the error in whatever way it wishes. When a background error occurs, the unwinding ends in the Tcl library and
there is no obvious way for Tcl to report the error.
When Tcl detects a background error, it saves information about the error and invokes a handler command registered by interp bgerror later
as an idle event handler. The default handler command in turn calls the bgerror command . Before invoking bgerror, Tcl restores the
errorInfo and errorCode variables to their values at the time the error occurred, then it invokes bgerror with the error message as its
only argument. Tcl assumes that the application has implemented the bgerror command, and that the command will report the error in a way
that makes sense for the application. Tcl will ignore any result returned by the bgerror command as long as no error is generated.
If another Tcl error occurs within the bgerror command (for example, because no bgerror command has been defined) then Tcl reports the
error itself by writing a message to stderr.
If several background errors accumulate before bgerror is invoked to process them, bgerror will be invoked once for each error, in the
order they occurred. However, if bgerror returns with a break exception, then any remaining errors are skipped without calling bgerror.
If you are writing code that will be used by others as part of a package or other kind of library, consider avoiding bgerror. The reason
for this is that the application programmer may also want to define a bgerror, or use other code that does and thus will have trouble inte-
grating your code.
EXAMPLE
This bgerror procedure appends errors to a file, with a timestamp.
proc bgerror {message} {
set timestamp [clock format [clock seconds]]
set fl [open mylog.txt {WRONLY CREAT APPEND}]
puts $fl "$timestamp: bgerror in $::argv '$message'"
close $fl
}
SEE ALSO after(3tcl), interp(3tcl), tclvars(3tcl)KEYWORDS
background error, reporting
Tcl 7.5 bgerror(3tcl)