🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #3998

Re: Bash equivalent of cmd /k switch

#3998
From: Janis Papanagnou
Date: Tue, 02 Jun 2009 20:48
22 lines
2229 bytes
Ben wrote:
> 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?

bash             # opens a new shell instance
some_command     # exectutes some_command in the new shell instance
                  # you won't leave the new shell instance
# here you're still in the second shell instance
# do whatever you like
exit             # now you're leaving the second shell instance
# here you're back in the first shell instance


There's really no need for those DOS "features".

Janis
Technical Details
Message-ID: <h0436l$e8t$1@svr7.m-online.net>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!feeder.erje.net!newsfeed.straub-nv.de!noris.net!news1.nefonline.de!news.m-online.net!not-for-mail
References: <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!news2.google.com!news.glorb.com!feeder.erje.net!newsfeed.straub-nv.de!noris.net!news1.nefonline.de!news.m-online.net!not-for-mail
From: Janis Papanagnou <janis_papanagnou@hotmail.com>
Newsgroups: comp.unix.shell,comp.unix.programmer,gnu.bash
Subject: Re: Bash equivalent of cmd /k switch
Date: Tue, 02 Jun 2009 22:48:20 +0200
Organization: (posted via) M-net Telekommunikations GmbH
Lines: 22
Message-ID: <h0436l$e8t$1@svr7.m-online.net>
References: <c7e2ac57-0e67-4727-a1ca-f5e4adea3803@r16g2000vbn.googlegroups.com>
NNTP-Posting-Host: ppp-88-217-60-10.dynamic.mnet-online.de
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: svr7.m-online.net 1243975701 14621 88.217.60.10 (2 Jun 2009 20:48:21 GMT)
X-Complaints-To: abuse@m-online.net
NNTP-Posting-Date: Tue, 2 Jun 2009 20:48:21 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4
X-Accept-Language: en-us, en
In-Reply-To: <c7e2ac57-0e67-4727-a1ca-f5e4adea3803@r16g2000vbn.googlegroups.com>