Article View: comp.unix.shell
Article #3999Re: Bash equivalent of cmd /k switch
From: Nate Eldredge
Date: Tue, 02 Jun 2009 20:56
Date: Tue, 02 Jun 2009 20:56
15 lines
1778 bytes
1778 bytes
Ben <bgold12@gmail.com> writes: > On Windows, cmd.exe has the /k switch, which lets you execute a > command given by a command-line argument, and then the shell remains > open after finishing the execution of the command. I know bash has -c > which lets you execute a command given by a command-line argument, but > then the shell closes after finishing the command (this is analogous > to the cmd.exe /c switch). My question is, is there a bash equivalent > of the cmd.exe /k switch that can be used to execute a command and > then remain open? You could write your command to a file, and use --rcfile to point to it. But I'm having a hard time understanding why you want to do this; most of the things I can imagine to do with this have better ways of doing them. What's your goal here?
Technical Details
Message-ID:
<86eiu2cq2e.fsf@vulcan.lan>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe23.iad.POSTED!4570aeb9!not-for-mailReferences:
<c7e2ac57-0e67-4727-a1ca-f5e4adea3803@r16g2000vbn.googlegroups.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 4d82dd0a1,dfab991ae69ee2e X-Google-Attributes: gid4d82dd0a1,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe23.iad.POSTED!4570aeb9!not-for-mail Newsgroups: comp.unix.shell,comp.unix.programmer,gnu.bash Subject: Re: Bash equivalent of cmd /k switch References: <c7e2ac57-0e67-4727-a1ca-f5e4adea3803@r16g2000vbn.googlegroups.com> From: Nate Eldredge <nate@vulcan.lan> Message-ID: <86eiu2cq2e.fsf@vulcan.lan> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (berkeley-unix) Cancel-Lock: sha1:FZSnsiaYTCqX2PI1VguPobSySM4= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Lines: 16 X-Complaints-To: abuse2@dslextreme.com NNTP-Posting-Date: Tue, 02 Jun 2009 20:56:46 UTC Organization: DSL Extreme Date: Tue, 02 Jun 2009 13:56:41 -0700