0

Format:

code --install-extension adpyke.codesnap --force &
code --install-extension alefragnani.Bookmarks --force &
code --install-extension arturock.gitstash --force &
code --install-extension csholmq.excel-to-markdown-table --force

Currently, I'm doing code --list-extensions | xargs -L 1 echo code --install-extension > install-extensions.sh to get the extensions printed to install-extensions.sh and manually add --force & at end of lines in that file, that's the furthest I can get.

I'm not very familiar with the bash syntax, could anyone please shed some light?

Wenfang Du
  • 8,804
  • 9
  • 59
  • 90

1 Answers1

0

After some diggings, I finally got it working, the working script:

code --list-extensions |
xargs -L 1 echo code --install-extension |
sed 's/$/ --force/' |
sed '$!s/$/ \&/' > install-extensions.sh

Reference: How can I add a comma at the end of every line except the last line?

Wenfang Du
  • 8,804
  • 9
  • 59
  • 90