Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14441

[PATCH] Re-display prompt if directory changed in a bind -x command

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From Bogdan Harjoc <harjoc@gmail.com>
Newsgroups gnu.bash.bug
Subject [PATCH] Re-display prompt if directory changed in a bind -x command
Date Mon, 6 Aug 2018 10:12:02 +0300
Lines 52
Approved bug-bash@gnu.org
Message-ID <mailman.4730.1533543201.1292.bug-bash@gnu.org> (permalink)
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type multipart/mixed; boundary="00000000000080d3330572befee0"
X-Trace usenet.stanford.edu 1533543202 18264 208.118.235.17 (6 Aug 2018 08:13:22 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=e/O+nI2GboTf3ShVaUqlMjv4UU5cNeKrgXq2x4XZjlo=; b=BIrE5APYKjUVUGtgCJjR9k0YCgDLuGW+dn/iXqAPUjX12zKiORecfwnJ1By4Q1D4YZ tlygQ35PiSy006n17l2P4Yb5hLjlITfTgZnWRlXgrWd7b9J+K67HT/Rr5uzQ+oNfhdk9 nsHMsw4jXP49skymjU/PFJ1zLKVL+xHs75nsM5tsDydx/FofqGMco491y0bRMrWfteb2 QI0nsgZTsJZBlCtKzGi3xstIJav7Wc+bVahdlst8dE6qC1I2HEjW+IUpibaMG5+lNHLS rnAissz7gXtq41mTMBlAWLvJ0qb9isgTphpf2VwSUM0uPZd4z1wUq/GRhKNM2hJyO54/ u3xQ==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=e/O+nI2GboTf3ShVaUqlMjv4UU5cNeKrgXq2x4XZjlo=; b=O7DtlyHBTf4mHvSfSXCoaWhZiwr6WYmNv4cbH7/mTwLO5851psebAnodfrA+SWJZwk ngWX2zdRWbGj57t+kGb7Id8ld7UcTuxKAwWpQMjH4neuTNBFhv3lsVeIH+jiSeoqZTW/ Ix52b2acoAr3OMgHSLdChIuv+4XZMdlSwhcS3bRYzYwRnRulTMqn4KwvNsTtM4WyWPzA atu6Q/qQlHMK931PQbaYouHEQRIAp9fl6I6HUDgpHXUZa83DAThzPjRGFBtAN8BkVy+d HuXt6rfB2IaWKpI4AyT8f/mmvuH28TOzwCTw3jGrp5HE9Na1CxrmB+6wlmZvaAzmSnt0 n2xg==
X-Gm-Message-State AOUpUlGr69pfT1DX4ZjJUaDt990Zpywwpx9oLY5qEdgb8yc8vm0GGuQ4 NN+cpWg7PoELuiWxHOrGkemtSSCboPj9yrgo+08V06rE
X-Google-Smtp-Source AAOMgpc+NijcTeWgT6+/b3y5Gs50+lJazPvIwu6g4Le9DlOTohycEKns3bOZ/WoW5+s8T7FAApYsbRMtiw6Hs2ZG+L8=
X-Received by 2002:a25:2146:: with SMTP id h67-v6mr6907833ybh.279.1533539522750; Mon, 06 Aug 2018 00:12:02 -0700 (PDT)
X-detected-operating-system by eggs.gnu.org: Genre and OS details not recognized.
X-Received-From 2607:f8b0:4002:c09::22f
X-Mailman-Approved-At Mon, 06 Aug 2018 04:13:20 -0400
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.21
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash/>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:14441

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

Using bind -x to call cd or source a script that changes the directory
will not update the prompt to show the new directory after the script
finished:

user@host:~$ bind -x '"\C-t": "echo test;cd /"'

# I press Ctrl-T
test
user@host:~$

Prompt still shows ~ as the pwd. Once I press Return or Ctrl-L the
prompt shows root as the pwd.

Updating the prompt is useful when using the mc-wrapper.sh script for
Midnight Commander that changes the bash pwd to the last mc directory
when mc exits. There is a similar wrapper for vim for example.

Attached patch decodes the prompt string again after running the
command passed to bind -x.

Regards,
Bogdan

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

[PATCH] Re-display prompt if directory changed in a bind -x command Bogdan Harjoc <harjoc@gmail.com> - 2018-08-06 10:12 +0300

csiph-web