←back to thread

217 points tanelpoder | 4 comments | | HN request time: 0.9s | source
Show context
enriquto ◴[] No.26493019[source]
The classic copy-pasteable prompt (for true graybeards) is simply

        PS1='; '
If you want some more information, the trick is this:

        PS1=': stuff ; '
where "stuff" is whatever string you want to show (without redirection characters). This works because the colon is the "true" executable that ignores all its arguments, and the semicolon introduces your command that can thus be pasted along the whole line.
replies(3): >>26493124 #>>26493993 #>>26496935 #
1. stonesweep ◴[] No.26493124[source]
Subtle greybeard update: ` :>/some/file ` still evaluates in shell, it will zero out a file (truncate) quick and dirty - the emphasis in enriquto's comment is still very important, do not include redirection chars.
replies(1): >>26493310 #
2. diffuse_l ◴[] No.26493310[source]
You don't even need the ':'.

'>/some/file' works as well.

replies(1): >>26493457 #
3. tremon ◴[] No.26493457[source]
Parent's point was that starting your prompt with `:` isn't a guarantee that everything that follows is safe (to expand on the "without redirection characters" remark by the OP).
replies(1): >>26494009 #
4. erlkonig ◴[] No.26494009{3}[source]
He did mention graybeards.