Prev: global Aqua+Terra MODIS (MCD43B4) mosaic with ncget-hdf, NetPBM and ImageMagick
Next: dump as hex value per each character
From: Jonathan de Boyne Pollard on 27 Jan 2010 20:03 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> <blockquote cite="mid:7a8f6$4a25987f$4c0aa020$8945(a)TEKSAVVY.COM-Free" type="cite"> <blockquote type="cite"> <p wrap="">My question is, is there a bash equivalent of the <code>cmd.exe /k</code> switch that can be used to execute a command and then remain open?<br> </p> </blockquote> <p wrap="">No. Probably because bash isn't the right tool for <em>that</em> job.<br> </p> </blockquote> <p>[...]</p> <blockquote cite="mid:7a8f6$4a25987f$4c0aa020$8945(a)TEKSAVVY.COM-Free" type="cite"> <p wrap="">Note that <code>CMD.EXE</code> opens a GUI text window, executes commands in it, and closes it again; there is no direct equivalent to this in Unix, as <code>bash</code> (and all other shell processors) are not GUI, and do not open windows for themselves.<br> </p> </blockquote> <p>Neither does <code>CMD</code>, which is in fact precisely like <code>bash</code> in this regard in that it has no notion of a graphical user interface. You are incorrect.</p> <p>What the <code>/k</code> option does is force <code>CMD</code> to enter interactive mode after it has finished processing whatever command was on its command-line. (With the <code>/c</code> option it does not enter interactive mode. With neither <code>/c</code> nor <code>/k</code> the default is to enter interactive mode.) The creation and destruction of the Win32 console is not done by <code>CMD</code>. It just uses whatever console it inherits. And it only even uses at all it if it enters interactive mode.<br> </p> <p>Yes, there's no <code>bash</code> equivalent to <code>/k</code>. Interestingly, and not yet noted in this thread, the POSIX <code>sh</code> <a href="http://opengroup.org./onlinepubs/000095399/utilities/sh.html">is defined</a> as accepting both <code>-c</code> and <code>-i</code> together, meaning that with a POSIX-conformant shell, one could, according to the text of the standard at least, use <code>sh -i -c <i>command</i></code> to achieve the same as <code>/k</code>. The <code>bash</code> documentation indicates these two to be mutually exclusive, however. This is a defect in the standard, in my view.<br> </p> </body> </html>
From: Sidney Lambe on 28 Jan 2010 00:05
On comp.unix.shell, Jonathan de Boyne Pollard <J.deBoynePollard-newsgroups(a)NTLWorld.COM> wrote: ><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> If you want your article read here, post using plain text. [delete] Killfiled another idiot. Sid comp.unix.shell |