[Solved] Vscode1.71.0 terminal error: `sed: illegal option — r`

Problem description

In the Mac environment, the terminal that comes with Vscode will show a sed prompt no matter what command it is.,There is no problem with using the built-in terminal

$ echo 'hi'
sed: illegal option -- r
usage: sed script [-Ealn] [-i extension] [file ...]
       sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ... ]
hi

System Environment

# system version
$sw_vers

ProductName: Mac OS X
ProductVersion: 10.14.4
BuildVersion: 18E2035

# vscode version
$ code -v
1.71.0
784b0177c56c607789f9638da7b6bf3230d47a8c
x64

Solution

Refer to the issue for a good solution to this problem

The official website also said that this problem will be fixed in the next version

Modify file /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh

Replace line 125

# __vsc_current_command="$(builtin history 1 | sed -r 's/ *[0 -9]+ +//')"
__vsc_current_command="$(builtin history 1 | sed -E 's/ *[0-9]+ +//')"

Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *