PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, October 6, 2022

[FIXED] How to fix "sed: illegal option -- r" error with every command on VS Code?

 October 06, 2022     terminal, visual-studio-code     No comments   

Issue

I am using the terminal in VS code on a Mac to run Python code, and with every command I return whether it results in an error or not, I get the following before my output:

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

I have no idea how this began showing up and no idea how to get rid of it.

Can someone please help point me in the right direction of removing this from my output?


Solution

Found on GitHub, worked flawlessly for me. I didn't even have the -r flag, so I just added -E after sed.

The solution is to edit the file /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh on line 125 and use the -E flag instead of -r (since both serve the same purpose - enable use of extended regular expressions - on linux). On Mac -r is not a valid option, hence the issue.

(i.e.:)

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


Answered By - Amalia Cicala
Answer Checked By - Mary Flores (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing