92,832 questions
Score of 3
3 answers
128 views
Why does subprocess.run(cmd, shell=True) with shlex.quote() break on Windows?
I'm invoking a CLI tool from Python using:
import subprocess, shlex
cmd = f'somecli eval {shlex.quote(js_code)}'
subprocess.run(cmd, shell=True, capture_output=True, text=True)
This works correctly ...
Score of 2
0 answers
91 views
Full documentation for the 'PS1' syntax used in 'adb shell' [closed]
I'm running Android 13. When I run adb shell in a USB connection from my desktop machine to my Android device, the following is the value of the PS1 variable that gets automatically set:
${|
...
Score of 1
7 answers
350 views
Scan directories and copy those that have more than n files
I have an mp3 library in a music folder structured by artist/album/song.mp3 (or other extension, but the folder contain audio only, so extension doesn't matter here).
I wish to copy this music ...
Score of 0
0 answers
94 views
How do I escape a string for use in a POSIX-compliant shell command-line? [duplicate]
In a C++ program, I have a string. For reasons, this string needs to be written into a shell script, either as a command-line argument, or for setting the value of a variable. The shell is POSIX-...
Score of -1
1 answer
341 views
What is the equivalent Cmd.exe program for this PowerShell one-liner program?
I have a program (program.exe) that converts XML files to HTML files. I use the following PowerShell command to convert all XML files in a specified directory to HTML files:
Get-ChildItem -Path E:\...
Score of 0
1 answer
68 views
Script commands run but only after being manually run
I have a script being used to transfer updated files between RHEL servers, the script runs the following loop:
for RHOST in $RHOSTS; do
ssh $RHOST cp -p "$CMD_DIR/$CMD" "$CMD_DIR/${...
Score of -1
1 answer
131 views
ansifilter doesn't filter ANSI escape codes
I have a written the below C++ program wherein I'm trying to imitate processing status in a console. Everything runs/displays correctly. When I redirect the program output to a file and then use ...
Score of 3
2 answers
138 views
How could this dash-style named function makes infinity calling in bash?
I can run code like this in bash
#: can works well:
#: (start a new bash)
foo_a () { echo a ; }
foo-a () { foo_a ; }
echo will out a:
foo_a
It works well.
These work well also:
#: can works well:
#: (...
Score of 1
1 answer
179 views
Setting prompt color based on last command status
I'm attempting to set the prompt of tcsh according to the status of the last command, as given by $status, but I'm encountering difficulties managing that.
Displaying the status itself is no trouble; ...
Score of -2
2 answers
124 views
xml: uncapturable attribute
xidel 'https://en.wikipedia.org/wiki/List_of_trigonometric_identities' -e '/html/body/div[3]/div/div[3]/main/div[3]/div[3]/div[2]/table[1]/tbody/tr[2]/td/span/a/img' --output-format=xml
outputs
<?...
Score of 0
3 answers
171 views
Bash PS1 containing Sixels
PS1 has either $(cat arch_prompt.sixels) or $(chafa arch_prompt.png) so I get that garbled mess. Sed doesn't work. The image gets garbled and doesn't work if it's removed, but as you see the small ...
Score of 0
1 answer
47 views
Make `find` output quoted or escaped paths? [duplicate]
I have a number of scripts that use find -depth to trawl directories in a "clever" way, e.g. to set file and directory times from EXIF metadata.
Every now and then I will forget about white ...
Score of 1
1 answer
238 views
Determine target platform without installing Rust
TL;DR: how can I determine the Rust target platform triple without installing Rust or Cargo?
I would like to download the appropriate pre-compiled binary program file. The pre-compiled binary program ...
Score of 1
1 answer
111 views
gcc gfortran compiler does not recognize blank spaces inside filenames [closed]
Is there a way to enforce the execution of the Fortran compiler contained in gcc-16.1.0-64 to recognize a blank space in a filename when executed in the Windows cmd.exe command line?
Others, like the ...
Score of 0
1 answer
78 views
Error rebuilding Spotlight indices with shell script [closed]
Spotlight wasn't finding stuff I knew was there, so I ran this Applescript:
do shell script"sudo mdutil -Ea"with administrator privileges
and got this error:
Error: CoreSpotlight reset ...