Quantcast
Channel: User Gilles Quénot - Stack Overflow
Browsing index pages (270 articles)
↧

Answer by Gilles Quénot for Bash Shell Script - Check for a flag and grab its...

You should read this getopts tutorial.Example with -a switch that requires an argument :#!/bin/bashwhile getopts ":a:" opt; do case $opt in a) echo "-a was triggered, Parameter: $OPTARG" >&2 ;;...

View Article


Answer by Gilles Quénot for AWK not able to extract the from field in the...

Using GNUawk:no need to pipe cat | awk, it's a UUOC aka Useless Use Of Catawk 'BEGIN{FPAT="from=.*>>"}{print $1}' filefrom=<"dexter prod" <dexter_noreply@au.edu>>See splitting by...

View Article


Answer by Gilles Quénot for What has happened to the 32 and 33 kill signals?

This is not CentOS focused. On Arch Linux, I have:kill -lOutput: 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR111) SIGSEGV 12) SIGUSR2 13)...

View Article

Answer by Gilles Quénot for What does 'set -e' mean in a Bash script?

From help set and Bash Reference Documentation: The Set Builtin:-e Exit immediately if a command exits with a non-zero status.But it's considered bad practice by some (Bash FAQ and IRCFreenode #bash...

View Article

Answer by Gilles Quénot for Floating point comparison in shell

Don't forget ksh! bash was largely inspired by ksh and they share many similarities.ksh$ echo $((10,1/1,1))9,18181818181818182When I need to do float computation, I switch to ksh to avoid bash code...

View Article


Answer by Gilles Quénot for Slow bash script using shuf. Alternative to shuf...

What I would do:#!/bin/bash items=(15 31 30 15 14 14 24 21 34 12 4 24 32 45 26 7 28 15 10 50 24)for nb in "${items[@]}"; do shuf -i 1-50 -n "$nb" echodone | awk '{$1=$1} 1' RS= OFS=,It take 1Ox less...

View Article

Answer by Gilles Quénot for bash script use function call in string substitution

One simple way:read _ _ var < <(~/bin/status)echo $varProcess Substitution >(command ...) or <(...) is replaced by a temporary filename. Writing or reading that file causes bytes to get...

View Article

Comment by Gilles Quénot on Piping into interactive shell

You need to pass dos2unix on your file. I bet it's Windows generated

View Article


Comment by Gilles Quénot on Slow bash script using shuf. Alternative to shuf...

Even, faster, but not given as a response, because LLM generated: gist.github.com/sputnick-dev/1f098287c093c3f6a48a323258796a6‌​a

View Article


Answer by Gilles Quénot for sed works, but just for some files

$ cat file{% include image.html src='/files/2025/05/zoho-mail-dominio.jpg' %}{% include image.html src="/files/2025/02/avast-explorer.jpg" %}{% include image.html src="/files/2012/07/java.jpg" %}Perl:...

View Article

Comment by Gilles Quénot on sed works, but just for some files

Perl is more readable ^^

View Article

Comment by Gilles Quénot on BASH: Checking if files are duplicates within a...

It's a bit of a cumbersome solution. Performances will be horrible and MD5 is known to have collisions since ages

View Article

Answer by Gilles Quénot for Replacing value in a line based on adjacent line...

With a proper XML parser in CLI: xmlstarlet:xmlstarlet ed -u '//prim_payer_class' -v 6 file.xml

View Article


Answer by Gilles Quénot for sed permission denied when overwriting file

Seems like you have a permission issue on the /tmp dir. (as discussed bellow, you run command in phpshell, so TMP dir can be setted elsewhere than /tmp)It should looks like :$ ls -ld /tmpdrwxrwxrwx 333...

View Article

Answer by Gilles Quénot for wget + JavaScript?

What I would do:import { chromium } from 'playwright';(async () => { const url = process.argv[2]; if (!url) { console.error('Usage: '+ process.argv[1] +'<URL>'); process.exit(1); } try { const...

View Article


Comment by Gilles Quénot on Script or batch file to find matching folder...

SO is not a free coding service

View Article

Comment by Gilles Quénot on Ignore patterns not found in ex substitute command

Looks cryptic ^^

View Article


Comment by Gilles Quénot on Ignore patterns not found in ex substitute command

There's also perl -i -pe 's///' that is working more smoothly across devices if Perl is embeded in the distro

View Article

Comment by Gilles Quénot on wget + JavaScript?

Don't paste links but show the code. That's the SO rules

View Article

Comment by Gilles Quénot on wget + JavaScript?

This is outdated in 2025

View Article
Browsing index pages (270 articles)


Latest Images