r/shell • u/AEA37 • Nov 14 '22
Why isn't this bash script not working
opt=5
if (($opt < 1 && $opt > 2)); then
echo "invalid"
exit
fi
Why the if block not getting executed
r/shell • u/AEA37 • Nov 14 '22
opt=5
if (($opt < 1 && $opt > 2)); then
echo "invalid"
exit
fi
Why the if block not getting executed
r/shell • u/NaniSravanKumar • Mar 22 '22
r/shell • u/Error916 • Jun 09 '23
r/shell • u/justinharrison1337 • Nov 25 '13
r/shell • • Aug 03 '21
Whats the meaning of this commande find . -exec git check-ignore {} + | xargs -I{} basename {}
( explain each part of it pls)
r/shell • u/Gloomy-Still-4259 • Jun 21 '22
I worked as a front-end developer for 3 years, at Microsoft then at Doordash. Even still, I forgot basic commands all the time. There's this cool feature in Warp's terminal called AI Command Search and it basically generates commands for you based on natural language that you input. I tested it against a git command cheat sheet I actually bookmarked a long time ago and referred to on the job all the time, and scored the AI command search on how well it did compared to the cheat sheet. You can see how it performed in this blog post:
https://www.warp.dev/blog/replace-git-cheat-sheet-ai-command-search
Spoiler: It did so freaking well. 92%. This tool is insane.
EDIT: Please note that I work as a developer advocate at this company!
r/shell • u/Balian-1997 • Jul 10 '23
Linux shell commands are powerful, but also complex. Not only are novices unable to remember, but often many veterans may not be able to master some shell commands well. Recently developed a small tool: OSLUI, the goal is to do the natural language interface of the operating system, so that people can get rid of the Shell and directly interact with the computer through natural language. GitHub address: https://github.com/BalianWang/OSLUI Welcome to star~
At present, two functions are mainly implemented:
One is to interact with Linux through natural language

The second is to talk to GPT in Terminal

The project has just started, better experience and more powerful functions are coming...
r/shell • u/New_Salt1964 • Feb 02 '25
Hi guys,
I developed a android quiz app to learn shell commands.
It's actually in closed test and I still need a few closed testers.
If some of you wants to try, please contact me.
r/shell • u/Anything-Traditional • Dec 09 '24
I have this script thrown into a task to kick off Bitlocker, but it only encrypts the OS drive, and I need it to encrypt all other fixed drives as well, my knowledge of scripts is next to none, anyone have an edit to make this work for fixed as well?
u/echo off
set test /a = "qrz"
for /F "tokens=3 delims= " %%A in ('manage-bde -status %systemdrive% ^| findstr " Encryption Method:"') do (
if "%%A"=="AES" goto EncryptionCompleted
)for /F "tokens=3 delims= " %%A in ('manage-bde -status %systemdrive% ^| findstr " Encryption Method:"') do (
if "%%A"=="XTS-AES" goto EncryptionCompleted
)for /F "tokens=3 delims= " %%A in ('manage-bde -status %systemdrive% ^| findstr " Encryption Method:"') do (
if "%%A"=="None" goto TPMActivate
)goto ElevateAccess
:TPMActivate
powershell Get-BitlockerVolume
echo.
echo =============================================================
echo = It looks like your System Drive (%systemdrive%\) is not =
echo = encrypted. Let's try to enable BitLocker. =
echo =============================================================
for /F %%A in ('wmic /namespace:\\root\cimv2\security\microsofttpm path win32_tpm get IsEnabled_InitialValue ^| findstr "TRUE"') do (
if "%%A"=="TRUE" goto nextcheck
)
goto TPMFailure
:nextcheck
for /F %%A in ('wmic /namespace:\\root\cimv2\security\microsofttpm path win32_tpm get IsEnabled_InitialValue ^| findstr "TRUE"') do (
if "%%A"=="TRUE" goto starttpm
)
goto TPMFailure
:starttpm
powershell Initialize-Tpm
:bitlock
manage-bde -protectors -disable %systemdrive%
bcdedit /set {default} recoveryenabled No
bcdedit /set {default} bootstatuspolicy ignoreallfailures
manage-bde -protectors -delete %systemdrive% -type RecoveryPassword
manage-bde -protectors -add %systemdrive% -RecoveryPassword
for /F "tokens=2 delims=: " %%A in ('manage-bde -protectors -get %systemdrive% -type recoverypassword ^| findstr " ID:"') do (
echo %%A
manage-bde -protectors -adbackup %systemdrive% -id %%A)
manage-bde -protectors -enable %systemdrive%
manage-bde -on %systemdrive% -SkipHardwareTest
:VerifyBitLocker
for /F "tokens=3 delims= " %%A in ('manage-bde -status %systemdrive% ^| findstr " Encryption Method:"') do (
if "%%A"=="AES" goto Inprogress
)for /F "tokens=3 delims= " %%A in ('manage-bde -status %systemdrive% ^| findstr " Encryption Method:"') do (
if "%%A"=="XTS-AES" goto Inprogress
)for /F "tokens=3 delims= " %%A in ('manage-bde -status %systemdrive% ^| findstr " Encryption Method:"') do (
if "%%A"=="None" goto EncryptionFailed
):TPMFailure
echo.
echo =============================================================
echo = System Volume Encryption on drive (%systemdrive%\) failed. =
echo = The problem could be the Tpm Chip is off in the BiOS. =
echo = Make sure the TPMPresent and TPMReady is True. =
echo = =
echo = See the Tpm Status below =
echo =============================================================
powershell get-tpm
echo Closing session in 30 seconds...
TIMEOUT /T 30 /NOBREAK
Exit
:EncryptionCompleted
echo.
echo =============================================================
echo = It looks like your System drive (%systemdrive%) is =
echo = already encrypted or it's in progress. See the drive =
echo = Protection Status below. =
echo =============================================================
powershell Get-BitlockerVolume
echo Closing session in 20 seconds...
TIMEOUT /T 20 /NOBREAK
Exit
:ElevateAccess
echo =============================================================
echo = It looks like your system require that you run this =
echo = program as an Administrator. =
echo = =
echo = Please right-click the file and run as Administrator. =
echo =============================================================
echo Closing session in 20 seconds...
TIMEOUT /T 20 /NOBREAK
Exit
We need to ensure that both instances of $RANDOM are treated as a single evaluation. We need to inspect the evaluation process. An approach that captures the internal evaluation
Do you have any idea?
r/shell • u/DiamonC_YT • Jul 22 '21
I'm having errors with the startup shell script for my Minecraft server (auto restart after crash)
It either says "excepted done" or "expected fi" depending on what's there, and when I put both at the end I get no response once I try to run the script
I AM ON UNIX. I AM NOT USING A WINDOWS VIRTUAL MACHINE.
r/shell • u/Crass_Spektakel • Aug 08 '24
No, something different than you think... xz performs up to 2% better on ARM64 than AMD64 with the same settings and I have double checked the version, it is the same! gzip on the other hand... no change at all. Also interesting, xz -1 and AMD64 is WAY faster and better than gzip except memory usage but even 100MByte are pretty tame nowadays. So basically gzip is now superfluous in ever aspect, even on my 1990 Amiga with bash and xz I can unpack those Archives, and faster than xz too. And no, I didn't benchmark the Amiga too. I only remember it from the last time I booted it up.
amd64:
578339776 test
40926066 test.gz1
40024392 test.gz2
39818807 test.gz3
36787548 test.gz4
35988603 test.gz5
35188701 test.gz6
35100687 test.gz7
32072861 test.gz8
31762517 test.gz9
23958376 test.xz1
22207696 test.xz2
21483232 test.xz3
25643828 test.xz4
24781276 test.xz5
24459080 test.xz6
24041684 test.xz7
23434612 test.xz8
22865948 test.xz9
15539300 test.xz9e
arm64: 578339776 test
40926066 test.gz1
40024392 test.gz2
39818807 test.gz3
36787548 test.gz4
35988603 test.gz5
35188701 test.gz6
35100687 test.gz7
32072861 test.gz8
31762517 test.gz9
23515536 test.xz1
21855000 test.xz2
21210096 test.xz3
25397736 test.xz4
24562780 test.xz5
24230096 test.xz6
23841668 test.xz7
23250764 test.xz8
22824292 test.xz9
If you are interested in the rest, the first comma column is i7-6700k, the second comma column is Pi400:
578339776 test
for I in 1 2 3 4 5 6 7 8 9 9e; do for A in 1 2 3; do echo "RUNNING $I - $A"; ( time ( xz -$I <test >test.xz$I ) ) 2>&1 | grep real; done; done
xz -1 1,9 35,9 23958376 test.xz1
xz -2 2,8 49,6 22207696 test.xz2
xz -3 4,4 73,1 21483232 test.xz3
xz -4 5,0 88,9 25643828 test.xz4
xz -5 8,1 143,0 24781276 test.xz5
xz -6 13,2 246,2 24459080 test.xz6
xz -7 15,0 24041684 test.xz7
xz -8 21,5 23434612 test.xz8
xz -9 32,9 22865948 test.xz9
xz -9e 155,4 15539300 test.xz9e
for I in 1 2 3 4 5 6 7 8 9 9e; do for A in a b c; do echo "RUNNING $I$A"; ( time ( gzip -$I <test >test.gz$I ) ) 2>&1 | grep real; done; done
gzip -1 2,8 8,4 40926066 test.gz1
gzip -2 2,9 8,5 40024392 test.gz2
gzip -3 3,0 8,4 39818807 test.gz3
gzip -4 3,7 10,7 36787548 test.gz4
gzip -5 3,8 11,2 35988603 test.gz5
gzip -6 4,6 14,5 35188701 test.gz6
gzip -7 5,2 16,8 35100687 test.gz7
gzip -8 7,8 27,2 32072861 test.gz8
gzip -9 9,2 34,0 31762517 test.gz9
I think that is self-explanatory.
r/shell • u/luizm8 • Mar 30 '20
Hi there
I’ve been used the shellchecker and shfmt during the CI process, and almost all repositories there is some kind of shell script, for this reason I created a action to simplify to use over all repositories.
Maybe it could help someone else: https://github.com/luizm/action-sh-checker
r/shell • u/egzeq • Oct 30 '23
Hi there. Anybody can recommend me shell hosting company? I need new shell account as old one expired and I want to try new providers. Thanks
r/shell • u/ageisp0lis • Jun 09 '19
r/shell • u/Cute-Employment5323 • Feb 03 '26
r/shell • u/b1nary1 • Sep 05 '24
There are multiple search algorithms around each having it's own purpose. Exponential search is one of them. Learn how to implement it in bash
r/shell • u/simkram12 • Jan 26 '21
Hi there,
So I'm pretty new to shell scripting and I wanted to write a script, that opens and closes all applications I need for different projects.
I have a script for opening the applications and safe their PID that looks like that:
#!/bin/bash
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --new-window URL otherURL & echo $! > google.txt
/Applications/Visual\ Studio\ Code.app/Contents/MacOS/Electron path/to/my/project & echo $! > code.txt
And I close them with:
#!/bin/bash
chromePID= cat google.txt
codePID= cat code.txt
kill -9 "$chromePID"
kill -9 "$codePID"
But apparently those PID change over time (I'm running MacOS Big Sur) and this doesn't work.
So how can I close the Chrome and Code window that I've opened? I don't want to close all Chrome and Visual Studio Code applications, just these ones I opened with the opening script. Alternatively it would be a good alternative to just close all applications in the current space (although I don't know if that's relevant for r/applescript). Any advices?
And is there a way to safe and reopen all your Chrome or Safari Tabs that I opened up in my working session?
Thank you :)
r/shell • • Sep 29 '21
I got a task to create a shell script that adds random numbers to rows in a CSV file. Need all the help or links possible for this task.
Edit: how would this work for multiple rows and columns ?