ShellCheck
PowerShell
Our great sponsors
- ONLYOFFICE ONLYOFFICE Docs — document collaboration in your environment
- SonarQube - Static code analysis for 29 languages.
- InfluxDB - Access the most powerful time series database as a service
ShellCheck | PowerShell | |
---|---|---|
457 | 370 | |
32,226 | 38,701 | |
- | 0.7% | |
7.5 | 9.8 | |
6 days ago | about 7 hours ago | |
Haskell | C# | |
GNU General Public License v3.0 only | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
ShellCheck
-
First time writing bash scripts for work, not sure if this is true elsewhere
not sure about unit/functional testing, but https://www.shellcheck.net/ is handy for linting and finding bad practice.
-
Bash newbie here, wanted to know your opinion
First, how did ShellSheck didn't give you warnings, if you checked it?
-
Bash script string argument is interpreted als multiple arguments
BTW, check out https://www.shellcheck.net/. You can install it to your computer and it'll warn you about this and many other ways you can accidentally shoot at your own foot with Bash.
-
Take your BASH scripting seriously
This is super easy but, may not always be enough.. Luckily, the fine people at ShellCheck gave this some thought and created a nifty tool. It’s got a nice README, is available via most decent package managers and, even has a web interface where you can test snippets (in case you’re bored and on the tube, I guess). The README also includes a Gallery of bad code to showcase some of the stuff shellcheck can pick up on.
-
Which Shell?
Bash because it's everywhere and I've put effort into learning it properly. My scripts almost always pass shellcheck first try, and I know the syntax of bash-specific features reasonably well. I don't see any advantage to learning another shell which I need to explicitly install and relearn all over again.
-
[P] Convert Any language to a Linux command (one-liner)
The Prompt logic could include some nuance to flag potentially harmful commands, but it would still be potentially fallible. However, you raise an excellent point, and value can be added by altering the workflow to run the results through a tool like shellcheck, where you can customize acceptable BASH commands.
-
Prompt advice for ChatGPT4
Idea: Incorporate shellcheck that repeats the code back to the bot until it passes shellcheck at least.
-
Why is it that a command run from the terminal command line produces line break but the same command run within bash script has no line break/
A good way to learn the finicky bits is to run all your scripts through shellcheck. (Better yet, find a plugin for your editor/IDE.) If it flags an issue, read the corresponding wiki page and see if you understand it.
-
Would love some feedback on my first set of shell scripts
Have you run them through shellcheck? https://www.shellcheck.net/
-
I made a volume and brightness indicator for i3wm using dunst
Nice work! I recommend using https://www.shellcheck.net/ to make sure your bash script is in a good modern shape
PowerShell
-
ThreadJob and $using can have some interesting pitfalls
Engine event processing bypasses "ShouldQueueAndProcessInExecutionThread" causing state corruption and crash due to Runspace affinity
- What are your favorite open source apps?
-
The weird world of Windows file paths
Also it is MIT-licensed open source today: https://github.com/PowerShell/PowerShell
- Microsoft fixes 5-year-old Defender bug, reducing Firefox-related CPU use by 75%
-
Can't install powershell on my mac 10.13
==> Downloading https://github.com/PowerShell/PowerShell/releases/download/v7.3.
-
Nushell.sh ls – where size > 10mb – –sort-by modified
NuShell is properly MIT-licensed, and is therefore Free Software.
Powershell is kind of MIT-licensed, except for the parts that aren't but are still an integral part of it, so not really, and is therefore not Free Software. At least, it's not DFSG-free.
-
bsdutils: Alternative to GNU coreutils using software from FreeBSD
No, they don't ship curl, see https://daniel.haxx.se/blog/2016/08/19/removing-the-powershe... and https://github.com/PowerShell/PowerShell/pull/1901.
-
Windows nanoserver github portable (ssh auth) fatal: Could not read from remote repository
# escape=` # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # Args used by from statements must be defined here: ARG InstallerEnvHost=mcr.microsoft.com ARG InstallerEnvRepo=windows/servercore ARG InstallerEnvTag=ltsc2022 ARG NanoEnvHost=mcr.microsoft.com ARG NanoEnvRepo=windows/nanoserver ARG NanoEnvTag=ltsc2022 # -------------------------------------------------------------------------------------------------------------------------------------- # STAGE 1 Build Environment # -------------------------------------------------------------------------------------------------------------------------------------- FROM ${InstallerEnvHost}/${InstallerEnvRepo}:$InstallerEnvTag AS installer-env1 # disable telemetry ENV POWERSHELL_TELEMETRY_OPTOUT="1" ARG PS_VERSION=7.3.2 ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v$PS_VERSION/PowerShell-$PS_VERSION-win-x64.zip ARG ZIP_VERSION=2201 ARG ZIP_PACKAGE_URL=https://www.7-zip.org/a/7z$ZIP_VERSION-x64.exe SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] RUN [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12; ` New-Item -ItemType Directory -Path C:\installer | Out-Null; ` Write-Output "Download PowerShell from $env:PS_PACKAGE_URL"; ` Invoke-WebRequest -Uri $env:PS_PACKAGE_URL -outfile C:\installer\powershell.zip -verbose; ` Expand-Archive C:\installer\powershell.zip -DestinationPath \PowerShell; ` Write-Output "Download 7-Zip from $env:ZIP_PACKAGE_URL"; ` Invoke-WebRequest -Uri $env:ZIP_PACKAGE_URL -OutFile C:\installer\7z.exe; ` Start-Process -FilePath C:\installer\7z.exe -ArgumentList '/S' -NoNewWindow -Wait -Verbose #Start the NanoServer Build of ePledge # -------------------------------------------------------------------------------------------------------------------------------------- # STAGE 2 Build Environment # -------------------------------------------------------------------------------------------------------------------------------------- FROM ${NanoEnvHost}/${NanoEnvRepo}:$NanoEnvTag AS installer-env2 COPY --from=installer-env1 ["/PowerShell", "/Program Files/PowerShell"] COPY --from=installer-env1 ["/Program Files/7-Zip", "/Program Files/7-Zip"] #Need to switch user to ContainerAdministrator in order to do a setx USER ContainerAdministrator RUN setx PATH "%PATH%;%ProgramFiles%\PowerShell;%ProgramFiles%\Git\cmd;%ProgramFiles%\Git\usr\bin;%ProgramFiles%\7-zip" /M USER ContainerUser ARG GIT_VERSION=2.39.2 ARG GIT_PACKAGE_URL=https://github.com/git-for-windows/git/releases/download/v$GIT_VERSION.windows.1/PortableGit-$GIT_VERSION-64-bit.7z.exe ARG GH_CLI_VERSION=2.23.0 ARG GH_CLI_PACKAGE_URL=https://github.com/cli/cli/releases/download/v$GH_CLI_VERSION/gh_${GH_CLI_VERSION}_windows_amd64.zip SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] RUN [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12; ` New-Item -ItemType Directory -Path C:\installer | Out-Null; ` Write-Output "Download Git from $env:GIT_PACKAGE_URL"; ` Invoke-WebRequest -Uri $env:GIT_PACKAGE_URL -OutFile C:\Installer\Git.7z.exe; ` 7z x C:\Installer\Git.7z.exe -ogit; ` Write-Output "Download Git CLI from $env:GH_CLI_PACKAGE_URL"; ` Invoke-WebRequest -Uri $env:GH_CLI_PACKAGE_URL -OutFile C:\Installer\GHCLI.zip; ` 7z x C:\Installer\GHCLI.zip -ogit # -------------------------------------------------------------------------------------------------------------------------------------- # Final Build STAGE # -------------------------------------------------------------------------------------------------------------------------------------- FROM ${NanoEnvHost}/${NanoEnvRepo}:$NanoEnvTag AS nanoserver-git COPY --from=installer-env1 ["/PowerShell", "/Program Files/PowerShell"] COPY --from=installer-env1 ["/Program Files/7-Zip", "/Program Files/7-Zip"] COPY --from=installer-env2 ["/Git", "/Program Files/Git"] USER ContainerAdministrator RUN setx PATH "%PATH%;%ProgramFiles%\PowerShell;;%ProgramFiles%\Git;%ProgramFiles%\Git\cmd;%ProgramFiles%\Git\usr\bin;%ProgramFiles%\7-zip" /M USER ContainerUser SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] #Create Base Level Directories RUN New-Item -ItemType Directory -Path C:\AdminScripts | Out-Null; ` New-Item -ItemType Directory -Path C:\AdminScripts\epledge-deploy | Out-Null; ` New-Item -ItemType Directory -Path C:\Users\ContainerUser\.ssh | Out-Null; ` Set-Location $ENV:ProgramFiles\Git # Copy Over Files & Folders COPY IdentityFiles C:/AdminScripts/IdentityFiles COPY .ssh C:/Users/ContainerUser/.ssh RUN git config --global core.sshCommand 'ssh -o StrictHostKeyChecking=no' CMD ["pwsh.exe"]
-
New PowerShell Version - v7.3.3: * [7.3.3] - 2023-02-23
Only found this in the repo itself Changelog 7.3
What are some alternatives?
bash-language-server - A language server for Bash
nushell - A new type of shell
winpty - A Windows software package providing an interface similar to a Unix pty-master for communicating with Windows console programs.
shfmt - Dockernized shfmt. This formats shell script.
terminal - The new Windows Terminal and the original Windows console host, all in the same place!
WFinfo - :computer: A fissure Companion App for Warframe
shellharden - The corrective bash syntax highlighter
PowerToys - Windows system utilities to maximize productivity
efm-langserver - General purpose Language Server
xonsh - :shell: Python-powered, cross-platform, Unix-gazing shell.
neomake - Asynchronous linting and make framework for Neovim/Vim
pdsh - A high performance, parallel remote shell utility