
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
decode-prompt
Advanced tools
parse bash $PS1 escape characters
var decode = require('../');
var s = decode(process.argv[2], { env: process.env });
console.log(s);
$ node example/prompt.js '\w \$ '
~/projects/decode-prompt $
$
substack : decode-prompt $ node example/prompt.js "<$PS1>"
<substack : decode-prompt $ >
substack : decode-prompt $
var decode = require('decode-prompt')
Return the decoded bash $PS1 string str.
opts.env - environment variables to use. $NAME and ${NAME} are decoded and
some options use opts.env as a fallback default value.opts.now - date for all the time functions to use, default: new Dateopts.hostname - the os.hostname() value to use, otherwise os.hostname()opts.jobs - number of jobs currently managed by the shell, default: 0opts.tty - the shell's tty name (like the tty command gives), default: -1opts.shell - the current $SHELL, default: opts.env.SHELL.opts.user - username to use, default: opts.env.USER.opts.version - version of the shell (bash), default: '0.0.0'opts.cwd - current working directory,
default: opts.env.PWD || process.cwd()opts.dirtrim - number of directories to trim output at with an ellipsis,
default: opts.env.DIRTRIM || 0opts.history - history number, default: 0opts.command - command number, default: 0opts.uid - uid, default: opts.env.UID || process.getuid()With npm do:
npm install decode-prompt
MIT
FAQs
parse bash $PS1 escape characters
We found that decode-prompt demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.