On Sun, 2005-08-28 at 09:31, Claude Jones wrote: > On Sun August 28 2005 6:04 am, gb spam wrote: > > > > cat > /etc/sysconfig/desktop << EOF > > DESKTOP="KDE" > > DISPLAYMANAGER="KDE" > > EOF > > > > You will need to restart X afterwards (not just log out). > > I know this doesn't have anything to do with the subject, but, would you mind > explaining this use of 'cat'? You appear to be using it as a quick text > editor. When I see new ways to do stuff like this, I make an effort to > understand how it works, but, I'm stumped. I've read the man cat but there's > nothing there. I don't know where to look next. Cat copies input to output and defaults to reading stdin, which defaults to being the keyboard - so it copies keyboard input to a file simply by redirecting the output where you want it. Unix was designed around text mode tools with the idea that more complicated actions could be done by piping the output of one into the input of the next, and Linux inherits this still-functional history. Most shell scripting involves manipulating stdin/stdout of various tools to glue their operations together and cat is probably the simplest of the bunch. And by the way, you can use control-d at the keyboard to send a logical EOF to the program. The <<EOF construction is normally only used in a shell script where you want to feed some canned text, possibly with variable substution, to the input of a program. If you want to learn more about this, look at the shell (bash) man page or shell scripting tutorials. The possibilities of i/o redirection, wild-card filename expansion, etc. aren't mentioned in each program's man page because they are universally done by the invoking shell before the program starts. -- Les Mikesell lesmikesell@xxxxxxxxx