[SOLVED] Re: variables in bash

2024-03-28 Thread Hans
Hi, thank you all for the fast response. It helped a lot and made everything clear. The problem is solved. Have a nice eastern. Best Hans

Re: variables in bash

2024-03-28 Thread Paul M Foster
On Thu, Mar 28, 2024 at 10:37:25AM +0100, Hans wrote: > Hi folks, > > just an easy question: > > What is the difference (if any) between the following two variables in a > shellfile in bash: > > 1. mypath=/home/user1/Tools/ Here you are assigning a value to the va

Re: variables in bash

2024-03-28 Thread Greg Wooledge
On Thu, Mar 28, 2024 at 10:37:25AM +0100, Hans wrote: > What is the difference (if any) between the following two variables in a > shellfile in bash: > > 1. mypath=/home/user1/Tools/ > 2. mypath="/home/user1/Tools/" They are the same. The quotes are optional here

variables in bash

2024-03-28 Thread Hans
Hi folks, just an easy question: What is the difference (if any) between the following two variables in a shellfile in bash: 1. mypath=/home/user1/Tools/ and $mypath or 2. mypath="/home/user1/Tools/" and $mypath Is this in bash the same? Do other shells (sh, zsh, whatever) handle

Re: bash parameter expansion "doesn't like" dots?

2024-03-05 Thread Max Nikulin
On Tue, 5 Mar 2024 at 02:59, Greg Wooledge wrote: We might *guess* that this change was made to make dash more strict about POSIX minimalism (removing extensions), but without documentation we can't do more than guess about motives. The motivation is to avoid difference in behavior when

Re: bash parameter expansion "doesn't like" dots?

2024-03-04 Thread David
On Tue, 5 Mar 2024 at 02:59, Greg Wooledge wrote: > On Tue, Mar 05, 2024 at 11:24:11AM +0900, John Crawley wrote: > > ^ worked as a negator in dash character classes up to Bullseye though, so > > something has changed recently. That's what my web searching failed to > > find... > > It looks

Re: bash parameter expansion "doesn't like" dots?

2024-03-04 Thread Greg Wooledge
On Tue, Mar 05, 2024 at 11:24:11AM +0900, John Crawley wrote: > ^ worked as a negator in dash character classes up to Bullseye though, so > something has changed recently. That's what my web searching failed to find... It looks like dash doesn't have up-to-date documentation on its changes.

Re: bash parameter expansion "doesn't like" dots?

2024-03-04 Thread John Crawley
t portable to sh. Running shellcheck on a *sh* script with a [^s] glob gives https://www.shellcheck.net/wiki/SC3026 "In POSIX sh, ^ in place of ! in glob bracket expressions is undefined." with some links. There is no warning in the case of a #!/bin/bash script. Thanks! Shellcheck a

Re: bash parameter expansion "doesn't like" dots?

2024-03-04 Thread Max Nikulin
k on a *sh* script with a [^s] glob gives https://www.shellcheck.net/wiki/SC3026 "In POSIX sh, ^ in place of ! in glob bracket expressions is undefined." with some links. There is no warning in the case of a #!/bin/bash script.

Re: bash parameter expansion "doesn't like" dots?

2024-03-04 Thread John Crawley
On 05/03/2024 11:02, Greg Wooledge wrote: On Tue, Mar 05, 2024 at 10:49:34AM +0900, John Crawley wrote: On 05/03/2024 05:27, David Wright wrote: Which shell also matters. The OP appears to be using ^ to negate, but ! has the advantage that it will be understood in bash and dash. I think

Re: bash parameter expansion "doesn't like" dots?

2024-03-04 Thread Greg Wooledge
On Tue, Mar 05, 2024 at 10:49:34AM +0900, John Crawley wrote: > On 05/03/2024 05:27, David Wright wrote: > > Which shell also matters. The OP appears to be using ^ to negate, > > but ! has the advantage that it will be understood in bash and dash. > > I think ^ has been d

Re: bash parameter expansion "doesn't like" dots?

2024-03-04 Thread John Crawley
On 05/03/2024 05:27, David Wright wrote: Pattern matching in the shell is not the same as in grep: the rules are different, but similar enough to confuse. Grep uses regular expressions, while the shell is usually globs. (I have no experience of shells other than dash and bash though.) Bash can

Re: bash parameter expansion "doesn't like" dots?

2024-03-04 Thread David Wright
On Mon 04 Mar 2024 at 11:51:29 (+0900), John Crawley wrote: > On 04/03/2024 10:07, David Wright wrote: > > On Sun 03 Mar 2024 at 17:58:53 (-0600), Albretch Mueller wrote: > > > bash doesn't seem to like dots too close to brackets: > > > > &

Re: bash parameter expansion "doesn't like" dots?

2024-03-03 Thread John Crawley
On 04/03/2024 10:07, David Wright wrote: On Sun 03 Mar 2024 at 17:58:53 (-0600), Albretch Mueller wrote: bash doesn't seem to like dots too close to brackets: echo "${_VAR//[^0-9a-zA-Z.,_-]/}" works fine. On 3/3/24, Albretch Mueller wrote: _VAR="admissions.piedmont.ed

Re: bash parameter expansion "doesn't like" dots?

2024-03-03 Thread David Wright
On Sun 03 Mar 2024 at 17:58:53 (-0600), Albretch Mueller wrote: > bash doesn't seem to like dots too close to brackets: > > echo "${_VAR//[^0-9a-zA-Z.,_-]/}" > > works fine. > > On 3/3/24, Albretch Mueller wrote: > > _VAR="admissions.piedmont.edu

Re: bash parameter expansion "doesn't like" dots?

2024-03-03 Thread Albretch Mueller
bash doesn't seem to like dots too close to brackets: echo "${_VAR//[^0-9a-zA-Z.,_-]/}" works fine. lbrtchx On 3/3/24, Albretch Mueller wrote: > _VAR="admissions.piedmont.edu_files?trackid=wnm:1980=what-is-the-second-fundamental-theorem-of-calculus(1).pdf" > &g

[HS] assistance au code (Re: Script BASH gestion des espaces des noms de fichier)

2024-02-05 Thread Sébastien NOBILI
Bonjour, Le 2024-02-05 16:07, Daniel Caillibaud a écrit : Oui, et je vous encourage à passer vos shell bash à shellcheck, il signale ce genre d'erreur (et plein d'autres). Il est parfois un peut trop zélé, mais on peut lui dire qu'on sait ce qu'on fait avec du # shellcheck disable=SC

Re: Script BASH gestion des espaces des noms de fichier

2024-02-05 Thread Daniel Caillibaud
Le 02/02/24 à 08:54, Jérémy Prego a écrit : > Pour éviter ce problème, on peut mettre les variables entre " > > du coup, ça donnerai: > > pdftk "$fichier1" stamp "$tampon" output "$fichier2" Oui, et je vous encourage à passer vos shell bash à s

Re: Script BASH gestion des espaces des noms de fichier

2024-02-02 Thread Pierre Malard
Essaie des cotes dans tes attributions de noms. Par exemple : TOTO="${NomFic}" avec NomFic="Mon Fichier" Pareillement cote les appels : Cmd —variable "${NomFic}" Par exemple. Le fait de coter l’appel de variable avec des double cote permet à BASH de considérer

Re: Script BASH gestion des espaces des noms de fichier

2024-02-02 Thread Erwann Le Bras
Effectivement François Merci d'avoir rectifié. Erwann Le 02/02/2024 à 13:09, François TOURDE a écrit : Le 19755ième jour après Epoch, Erwann Le Bras écrivait: Éviter les boucles "for" avec listes de fichiers (for f in `ls "$dir"`) ou (for f in *), les espaces sont mal interprétés. Ça

Re: Script BASH gestion des espaces des noms de fichier

2024-02-02 Thread François TOURDE
Le 19755ième jour après Epoch, Erwann Le Bras écrivait: > Éviter les boucles "for" avec listes de fichiers (for f in `ls > "$dir"`) ou (for f in *), les espaces sont mal interprétés. Ça marche très bien l'utilisation avec for f in *, si tu prends soin d'utiliser "$f" plutôt que juste $f Par

Re: Script BASH gestion des espaces des noms de fichier

2024-02-02 Thread Erwann Le Bras
bonjour comme dis par ailleurs, pas de problème avec les espaces si les variables et chemins sont bien protégés  avec des doubles-cotes (["]) fichier="mon fichier" dir="$HOME/mon répertoire" cp "$fichier" "$dir" Éviter les boucles "for" avec listes de fichiers (for f in `ls "$dir"`) ou (for

Re: Script BASH gestion des espaces des noms de fichier

2024-02-02 Thread Informatique BILLARD
merci je ne connaissais pas cet outils François-Marie Le 02/02/2024 à 09:54, Klaus Becker a écrit : Detox est ton ami Klaus

Re: Script BASH gestion des espaces des noms de fichier

2024-02-02 Thread Informatique BILLARD
Bon j'ai tourné le problème dans tous les sens et finalement j'ai opté pour ceci 1. le nom du fichier passé comme argument au script est traité pour remplacer les espaces par des underscore. 2. je fait un renommage de ce fichier avec le nom sans espaces. 3. Puis traitement et tout

Re: Script BASH gestion des espaces des noms de fichier

2024-02-02 Thread Klaus Becker
Detox est ton ami Klaus

Re: Script BASH gestion des espaces des noms de fichier

2024-02-02 Thread Informatique BILLARD
fois je vais perdre l'intérêt du script. tampon=/user/Document/cachet.pdf et ensuite lancer votre script avec /bin/bash -vx lescriptbash Merci par avance François-Marie

Script BASH gestion des espaces des noms de fichier

2024-02-02 Thread Informatique BILLARD
Bonjour j'ai écrit un petit script qui lance à la fin cette commande : pdftk $fichier1 stamp $tampon output $fichier2 avec $fichier1 et $tampon, $fichier2  sont construit à partir des paramètres fournis au script . Mais je rencontre un problème quand il y a un espace dans le nom de fichier

Re: Script BASH gestion des espaces des noms de fichier

2024-02-02 Thread Cyrille
Bjr, > tampon=/user/Document/cachet\ pdf et tampon="/user/Document/cachet\ pdf" (utiliser des double quote ?? ++

Re: Script BASH gestion des espaces des noms de fichier

2024-02-01 Thread Jérémy Prego
bonjour, Le 02/02/2024 à 08:41, Informatique BILLARD a écrit : Bonjour j'ai écrit un petit script qui lance à la fin cette commande : pdftk $fichier1 stamp $tampon output $fichier2 Pour éviter ce problème, on peut mettre les variables entre " du coup, ça donnerai: pdftk "$fichier1"

Re: Script BASH gestion des espaces des noms de fichier

2024-02-01 Thread Basile Starynkevitch
noms de fichiers. Pourquoi ne pas coder par exemple tampon=/user/Document/cachet.pdf et ensuite lancer votre script avec /bin/bash -vx lescriptbash Merci par avance François-Marie -- Basile Starynkevitch (only mine opinions / les opinions sont miennes uniquement) 92340 Bourg-la

Script BASH gestion des espaces des noms de fichier

2024-02-01 Thread Informatique BILLARD
Bonjour j'ai écrit un petit script qui lance à la fin cette commande : pdftk $fichier1 stamp $tampon output $fichier2 avec $fichier1 et $tampon, $fichier2  sont construit à partir des paramètres fournis au script . Mais je rencontre un problème quand il y a un espace dans le nom de fichier

Re: exemple en GNU bash de variable tableau

2024-01-29 Thread Étienne Mollier
Bonsoir Basile, Basile Starynkevitch, on 2024-01-29: > J'essaie de collecter dans une variable tableau de bash files_to_remove les > fichiers temporaires (qu'il faudrait suprimer à la fin de cez script). > > Je n'arrive pas à comprendre la syntaxe des variables tableau en GNU bas

Re: exemple en GNU bash de variable tableau

2024-01-29 Thread Basile Starynkevitch
On 1/29/24 16:48, Michel Verdier wrote: Le 29 janvier 2024 Basile Starynkevitch a écrit : J'essaie de collecter dans une variable tableau de bash files_to_remove les fichiers temporaires (qu'il faudrait suprimer à la fin de cez script). Pourquoi un tableau ? Une simple liste ne suffit pas

Re: exemple en GNU bash de variable tableau

2024-01-29 Thread Michel Verdier
Le 29 janvier 2024 Basile Starynkevitch a écrit : > J'essaie de collecter dans une variable tableau de bash files_to_remove les > fichiers temporaires (qu'il faudrait suprimer à la fin de cez script). Pourquoi un tableau ? Une simple liste ne suffit pas ?

Re: exemple en GNU bash de variable tableau

2024-01-29 Thread bidons59
Bonjour Suis certainement à côté de la plaque, mais l'instruction "trap" pourrait peut être faire l'affaire? On 29/01/2024 12:42, didier gaumet wrote: Bonjour, Avertissement: j'ai jamais vraiment écrit quoi que ce soit en Bash donc ne pas se fier aveuglément à mes paroles De

Re: exemple en GNU bash de variable tableau

2024-01-29 Thread didier gaumet
Bonjour, Avertissement: j'ai jamais vraiment écrit quoi que ce soit en Bash donc ne pas se fier aveuglément à mes paroles De ce que je comprends, Bash ne gère pas nativement les tableaux multi-dimensions (cf la doc Bash): https://www.gnu.org/software/bash/manual/html_node/Arrays.html il

exemple en GNU bash de variable tableau

2024-01-29 Thread Basile Starynkevitch
Bonjour la liste Dans https://github.com/RefPerSys/RefPerSys (un projet de moteur d'inférences sous licence GPLv3+ pour Debian) j'essaie de coder un script en bash de configuration (simple). Voir le commit bfb1314 du fichier do-configure-refpersys.bash (les commentaires sont en mauvais

Le bash et le zhc ?

2024-01-14 Thread ptilou
Slt, Bon je commence la formation : https://www-eni-training-com.bnf.idm.oclc.org/portal/client/video/home Scripting sous Linux Et donc comme au Cnit la Défense un Debiantiste, dont j'ai peut-etre encore les cd, m'a dit laisse tomber RedHat, vient chez les vrai Oui oui il a dit des

Re: single quote "'" in bash xterm or lxterminal

2024-01-01 Thread David Wright
On Sun 31 Dec 2023 at 00:43:40 (-0600), Mike McClain wrote: > I > suspect logging into a system where you have no home for your primary > user might get interesting. That problem is simple to resolve. I have encrypted /home partitions on all my systems, but the root filesystem has a

Re: single quote "'" in bash xterm or lxterminal

2023-12-30 Thread Mike McClain
Mr. Wooledge, Long before I realized I could put /home/mike on a separate partition I started putting my stuff on a separate partition and just called it /mc. A couple of tomes I had different OS versions on the same hard drive so it made sense to keep the portions of my stuff that weren't OS

Re: single quote "'" in bash xterm or lxterminal

2023-12-29 Thread Max Nikulin
On 30/12/2023 09:14, Mike McClain wrote: Since some of these use a spinoff of xterm [ -n $DISPLAY ] is a little more generic than [ $TERM == xterm ], RaspberryPI has chosen lxterminal as their default which would would fail that test but still runs bash. I would expect that the reason

Re: single quote "'" in bash xterm or lxterminal

2023-12-29 Thread Greg Wooledge
On Fri, Dec 29, 2023 at 08:14:37PM -0600, Mike McClain wrote: > As it turns out every line in /mc/bin/xterm_bindings that > was not a comment was problematic.From man readline or info readline > I saw this: bind '"\C-x\C-r": re-read-init-file' and that is the syntax > I used in xterm_bindings,

Re: single quote "'" in bash xterm or lxterminal

2023-12-29 Thread Mike McClain
se use a spinoff of xterm [ -n $DISPLAY ] is a little more generic than [ $TERM == xterm ], RaspberryPI has chosen lxterminal as their default which would would fail that test but still runs bash. In spite of having used linux for years I'm still a 'luser' compared to you and often fumble as th

Re: single quote "'" in bash xterm or lxterminal

2023-12-27 Thread Greg Wooledge
hich line of the /mc/bin/xterm_bindings file actually caused the issue. I'm guessing it was either a typo, or a conceptual error in setting up the desired binding. Background info for those following along: The bind command (a bash builtin) installs readline key bindings -- in this case, from a

Re: single quote "'" in bash xterm or lxterminal

2023-12-27 Thread Max Nikulin
On 26/12/2023 23:57, Mike McClain wrote: Only when xterm_bindings has no executable lines in it does it not kill '"' in an X terminal window. The line that pulled it in was ; [ -n "$DISPLAY" ] && [ -f /mc/bin/xterm_bindings ] && bind -f /mc/bin/xterm_bindings; I do not see anything that may

Re: single quote "'" in bash xterm or lxterminal

2023-12-26 Thread Mike McClain
You guys were rigt all along, I just couldn't see it. Greg's suggestion to try dash showed me the error of my ways. I moved .inputrc to no.inputrc, commented out the line in bash.environment that pulled in xterm_bindings, killed and restarted X and sure enough I had '"' in an lxterminal window. I

Re: single quote "'" in bash xterm or lxterminal

2023-12-26 Thread Max Nikulin
l settings and capabilities that may affect "'". Anyway echo $TERM What happens if single quote is typed when "cat" is running? Does behavior of bash change when it is running in "screen" or "tmux" in VT or in a GUI terminal application. They use dif

Re: single quote "'" in bash xterm or lxterminal

2023-12-25 Thread Greg Wooledge
unch a new xterm (et al.) or when you shell-escape from programs that offer this feature. To see what shell you're currently in, try: ps -p $$ > As this demonstrates, I get single quotes in bash in a VT but not in X. But you DO get single-quotes in jed in X, or in dash in X?

Re: single quote "'" in bash xterm or lxterminal

2023-12-25 Thread Mike McClain
root@RPI4b3:~> tty; echo $SHELL; echo "' " | hd /dev/tty1 /bin/bash 27 20 0a |' .| 0003 mike@RPI4b3:~> tty; echo $SHELL; echo "' " | hd /dev/tty6 /bin/bash 27 20 0a

Re: single quote "'" in bash xterm or lxterminal

2023-12-25 Thread Greg Wooledge
happen, and which of these files were edited right before then? Oh, and just for additional data: if you start a terminal, and then run "dash" (or any other shell that isn't bash), does the problem go away, or does it still happen? (I'm pretty sure it'll go away, same as it does w

Re: single quote "'" in bash xterm or lxterminal

2023-12-24 Thread Mike McClain
;, "'o" = "o", etc. I've examined /etc/inputrc, .inputrc, /etc/bash.bashrc, ~/.bashrc, /etc/profile, /etc/profile.d/*, ~/.profile, ~/.bash_profile, both of the latter two just pull in ~/.bashrc which pulls in bash.{aliases,environment,functions} which are just stuff that starte

Re: single quote "'" in bash xterm or lxterminal

2023-12-23 Thread tomas
On Sat, Dec 23, 2023 at 09:06:47PM -0500, Greg Wooledge wrote: > On Sun, Dec 24, 2023 at 09:01:09AM +0700, Max Nikulin wrote: > > On 24/12/2023 07:32, Mike McClain wrote: > > > when I > > > type a single quote "'" in bash xterm or lxterminal nothing shows. >

Re: single quote "'" in bash xterm or lxterminal

2023-12-23 Thread Greg Wooledge
On Sun, Dec 24, 2023 at 09:01:09AM +0700, Max Nikulin wrote: > On 24/12/2023 07:32, Mike McClain wrote: > > when I > > type a single quote "'" in bash xterm or lxterminal nothing shows. > > May it happen that you have dead keys in your keyboard configuration to ty

Re: single quote "'" in bash xterm or lxterminal

2023-12-23 Thread Max Nikulin
On 24/12/2023 07:32, Mike McClain wrote: when I type a single quote "'" in bash xterm or lxterminal nothing shows. May it happen that you have dead keys in your keyboard configuration to type characters with accents? I have never used this feature, so my guess may be wrong. Wh

Re: single quote "'" in bash xterm or lxterminal

2023-12-23 Thread Greg Wooledge
On Sat, Dec 23, 2023 at 06:32:35PM -0600, Mike McClain wrote: > I seldom use the command line while on the desk top since I keep 10 > VTs open for day to day tasks so only recently noticed that when I > type a single quote "'" in bash xterm or lxterminal nothing shows.

single quote "'" in bash xterm or lxterminal

2023-12-23 Thread Mike McClain
I seldom use the command line while on the desk top since I keep 10 VTs open for day to day tasks so only recently noticed that when I type a single quote "'" in bash xterm or lxterminal nothing shows. If I open a file for editing with jed, my favorite editor, I can type a si

Re: bash vs. dash and stdin

2023-11-23 Thread Max Nikulin
On 22/11/2023 19:17, Greg Wooledge wrote: On Wed, Nov 22, 2023 at 07:06:58PM +0700, Max Nikulin wrote: ssh localhost echo remote echo local This is like <https://mywiki.wooledge.org/BashFAQ/089>. ssh grabs all of the stdin (until EOF) and leaves none for bash. Thanks. I ex

Re: bash vs. dash and stdin

2023-11-22 Thread Nicolas George
Max Nikulin (12023-11-22): > Is there a document that describes shell behavior in respect to stdin in > such cases? The shell did not eat your stdin here, ssh did. Regards, -- Nicolas George

Re: bash vs. dash and stdin

2023-11-22 Thread Greg Wooledge
On Wed, Nov 22, 2023 at 07:06:58PM +0700, Max Nikulin wrote: > Consider a file (ssh.sh) containing a couple of commands: > >ssh localhost echo remote >echo local > > Let's try to run it (assuming key-based authorization) > > bash remote You're t

bash vs. dash and stdin

2023-11-22 Thread Max Nikulin
it (assuming key-based authorization) bash Is there a document that describes shell behavior in respect to stdin in such cases? If the script is passed as an argument, not to stdin, then output contains "local" in both cases. I admit that ssh (called this way) can not avoid

Re: Using the bash shell: determine if the root user used 'sudo -i'

2023-08-26 Thread Greg Wooledge
On Sat, Aug 26, 2023 at 06:42:42PM -0400, Karl Vogel wrote: > If you're running bash, the safest way to find your current working > directory is capturing the output from /bin/pwd. Symlinked directories > can surprise you: > > me$ cd > > me$ ls -ldF today > l

Re: Using the bash shell: determine if the root user used 'sudo -i'

2023-08-26 Thread Karl Vogel
On Sat, Aug 26, 2023 at 12:09:57PM -0400, Tom Browder wrote: > Excellent mind-reading, Greg! So to use your line I will put in that dir: > "cd /required-dir || exit" > > Thanks so much. And thanks to all others who responded. If you're running bash, the safest wa

Re: Using the bash shell: determine if the root user used 'sudo -i'

2023-08-26 Thread tomas
On Sat, Aug 26, 2023 at 01:54:41PM -0500, Tom Browder wrote: > On Sat, Aug 26, 2023 at 10:42 wrote: [...] > > Basically it is not possible to find out [...] > As I think I replied earier, I am now checking the script is in the > required directory in order to be executed (by the root user)

Re: Using the bash shell: determine if the root user used 'sudo -i'

2023-08-26 Thread Tom Browder
On Sat, Aug 26, 2023 at 10:42 wrote: > On Sat, Aug 26, 2023 at 04:45:54PM +0200, DdB wrote: > > Am 26.08.2023 um 16:25 schrieb Tom Browder: > > > Is there a way to distinguish whether 'sudo -i' was used or not? > > > > > Sorry, i am not an expert on this. But ... since years i am using this > >

Re: Using the bash shell: determine if the root user used 'sudo -i'

2023-08-26 Thread Nate Bargmann
* On 2023 26 Aug 11:10 -0500, Tom Browder wrote: > On Sat, Aug 26, 2023 at 10:57 Greg Wooledge wrote: > > > On Sat, Aug 26, 2023 at 10:49:45AM -0500, Tom Browder wrote: > > > I would like to know whether 'sudo -i' or 'sudo -s' was used. > > ... > > > In fact, I suspect "I need to know if the

Re: Using the bash shell: determine if the root user used 'sudo -i'

2023-08-26 Thread tomas
On Sat, Aug 26, 2023 at 11:56:27AM -0400, Greg Wooledge wrote: > On Sat, Aug 26, 2023 at 10:49:45AM -0500, Tom Browder wrote: > > I would like to know whether 'sudo -i' or 'sudo -s' was used. > > That's STILL an X-Y problem. > > > The reason is > > to know if the cwd is set to '/root' or '.'

Re: Using the bash shell: determine if the root user used 'sudo -i'

2023-08-26 Thread Michael Kjörling
On 26 Aug 2023 11:56 -0400, from g...@wooledge.org (Greg Wooledge): > You don't actually need to know what was typed. And even being able to answer the question "how was sudo executed" doesn't solve the problem of ensuring that the script is executing within a particular directory. All it takes

Re: Using the bash shell: determine if the root user used 'sudo -i'

2023-08-26 Thread Tom Browder
On Sat, Aug 26, 2023 at 10:57 Greg Wooledge wrote: > On Sat, Aug 26, 2023 at 10:49:45AM -0500, Tom Browder wrote: > > I would like to know whether 'sudo -i' or 'sudo -s' was used. ... > In fact, I suspect "I need to know if the cwd is /root" is STILL an X-Y > problem. It's sounding like "I

Re: Using the bash shell: determine if the root user used 'sudo -i'

2023-08-26 Thread Greg Wooledge
On Sat, Aug 26, 2023 at 10:49:45AM -0500, Tom Browder wrote: > I would like to know whether 'sudo -i' or 'sudo -s' was used. That's STILL an X-Y problem. > The reason is > to know if the cwd is set to '/root' or '.' It's critical for the script > execution Oh? Then just look at the current

Re: Using the bash shell: determine if the root user used 'sudo -i'

2023-08-26 Thread Tom Browder
On Sat, Aug 26, 2023 at 09:32 Roberto C. Sánchez wrote: > On Sat, Aug 26, 2023 at 09:25:10AM -0500, Tom Browder wrote: > >In a previous thread it was shown how to detect a SUDO_USER in a bash > >shell. > >Is there a way to distinguish whether 'sudo -i' was used o

Re: Using the bash shell: determine if the root user used 'sudo -i'

2023-08-26 Thread tomas
On Sat, Aug 26, 2023 at 04:45:54PM +0200, DdB wrote: > Am 26.08.2023 um 16:25 schrieb Tom Browder: > > Is there a way to distinguish whether 'sudo -i' was used or not? > > > Sorry, i am not an expert on this. But ... since years i am using this > to check for it: > > > # if `echo $HOME` is not

Re: Using the bash shell: determine if the root user used 'sudo -i'

2023-08-26 Thread Alain D D Williams
On Sat, Aug 26, 2023 at 09:25:10AM -0500, Tom Browder wrote: > In a previous thread it was shown how to detect a SUDO_USER in a bash shell. > > Is there a way to distinguish whether 'sudo -i' was used or not? I have not tested this but if bash was interactive you will find a .bash_his

Re: Using the bash shell: determine if the root user used 'sudo -i'

2023-08-26 Thread DdB
Am 26.08.2023 um 16:25 schrieb Tom Browder: > Is there a way to distinguish whether 'sudo -i' was used or not? > Sorry, i am not an expert on this. But ... since years i am using this to check for it: > # if `echo $HOME` is not "/root" or the working dir (pwd) is not "/root", > then this was

Re: Using the bash shell: determine if the root user used 'sudo -i'

2023-08-26 Thread Roberto C . Sánchez
On Sat, Aug 26, 2023 at 09:25:10AM -0500, Tom Browder wrote: >In a previous thread it was shown how to detect a SUDO_USER in a bash >shell. >Is there a way to distinguish whether 'sudo -i' was used or not? >Thanks. >-Tom The SUDO_COMMAND environment variable wo

Using the bash shell: determine if the root user used 'sudo -i'

2023-08-26 Thread Tom Browder
In a previous thread it was shown how to detect a SUDO_USER in a bash shell. Is there a way to distinguish whether 'sudo -i' was used or not? Thanks. -Tom

BASH {VARNAME}>&- redirection (was: Re: Konsole is not bash)

2023-08-22 Thread Max Nikulin
sn't work. At first glance it is documented and effect of {fd}>&- is limited to the function call info "(bash) Redirections" If {VARNAME} is supplied, the redirection persists beyond the scope of the command, allowing the shell programmer to manage the file descriptor's l

Re: Konsole is not bash

2023-08-22 Thread Greg Wooledge
See, this is why I hate using bash extensions. So many weird corner cases and surprises As it turns out, the answer I gave yesterday was only partially correct. The "pure sh" solution is fine, but I offered this bash alternative: cmd {fd}>&1 1>&2 2>&$fd

Re: Konsole is not bash

2023-08-20 Thread Greg Wooledge
h. cmd 3>&1 1>&2 2>&3 3>&- Obviously this relies on FD 3 not being in use at that point. In pure sh, you'd need to have knowledge of *some* FD number which is available. In bash, you can use {somevar}>&1 to let the shell pick an FD for you, but that's an extension. cmd {fd}>&1 1>&2 2>&$fd {fd}>&-

Re: Konsole is not bash

2023-08-20 Thread Max Nikulin
On 21/08/2023 01:05, Felix Miata wrote: In the most recent versions of Konsole I've started (5.27.x), the default profile has inexplicably been changed from /bin/bash to /bin/sh. Is it konsole or plasma version? May it happen that /bin/sh was just saved to your konsole config files

Re: Konsole is not bash

2023-08-20 Thread Max Nikulin
On 21/08/2023 01:48, Greg Wooledge wrote: Some shell features do change over time, but the significant ordering of redirections has remained stable ever since the original Bourne shell. An exercise that relies on order of redirections and thus demonstrates its importance: Swap stderr and

Re: Konsole is not bash

2023-08-20 Thread gene heskett
On 8/20/23 14:23, Greg Wooledge wrote: On Sun, Aug 20, 2023 at 02:05:49PM -0400, Felix Miata wrote: Bob Weber composed on 2023-08-20 11:04 (UTC-0400): gene heskett wrote: I cannot make bashes redirection (cmd 2>&1 >tmp/cmd.log) work in Konsole. What terminal actually

Re: Konsole is not bash

2023-08-20 Thread John Hasler
Gene writes: > And that order of arguments is not mentioned in the bash scripting > manual It isn't an argument. It's an instruction to the shell. See the REDIRECTION section of the bash man page. -- John Hasler j...@sugarbit.com Elmwood, WI USA

Re: Konsole is not bash

2023-08-20 Thread Greg Wooledge
hat about > monthly but not yet. Sorry for the confusion. Greg sorted me out, and my > several year old dead tree 500 page tome on bash scripting is out of date. The way redirections work has not changed, ever. It has always been this way. Some shell features do change over time, but the signi

Re: Konsole is not bash

2023-08-20 Thread gene heskett
On 8/20/23 10:52, Cindy Sue Causey wrote: On 8/20/23, gene heskett wrote: I cannot make bashes redirection (cmd 2>&1 >tmp/cmd.log) work in Konsole. What terminal actually uses bash for the heavy lifting? Well, I started out attempting to play along in xfce4-terminal and received:

Re: Konsole is not bash

2023-08-20 Thread Greg Wooledge
On Sun, Aug 20, 2023 at 02:05:49PM -0400, Felix Miata wrote: > Bob Weber composed on 2023-08-20 11:04 (UTC-0400): > > > gene heskett wrote: > > >> I cannot make bashes redirection (cmd 2>&1 >tmp/cmd.log) work in Konsole. > >> What > >&g

Re: Konsole is not bash

2023-08-20 Thread gene heskett
On 8/20/23 10:36, Greg Wooledge wrote: On Sun, Aug 20, 2023 at 10:28:44AM -0400, gene heskett wrote: I cannot make bashes redirection (cmd 2>&1 >tmp/cmd.log) work in Konsole. What terminal actually uses bash for the heavy lifting? The terminal is irrelevant. This is ent

Re: Konsole is not bash

2023-08-20 Thread Felix Miata
Bob Weber composed on 2023-08-20 11:04 (UTC-0400): > gene heskett wrote: >> I cannot make bashes redirection (cmd 2>&1 >tmp/cmd.log) work in Konsole. >> What >> terminal actually uses bash for the heavy lifting? > In konsole its in the settings for the prof

Re: Konsole is not bash

2023-08-20 Thread Bob Weber
On 8/20/23 10:28, gene heskett wrote: I cannot make bashes redirection (cmd 2>&1 >tmp/cmd.log) work in Konsole. What terminal actually uses bash for the heavy lifting? Cheers, Gene Heskett. In konsole its in the settings for the profile you are using.  Mine just says bash not /us

Re: Konsole is not bash

2023-08-20 Thread Cindy Sue Causey
On 8/20/23, gene heskett wrote: > I cannot make bashes redirection (cmd 2>&1 >tmp/cmd.log) work in > Konsole. What terminal actually uses bash for the heavy lifting? Well, I started out attempting to play along in xfce4-terminal and received: bash: tmp/cmd.log: No such file or

Re: Konsole is not bash

2023-08-20 Thread Greg Wooledge
On Sun, Aug 20, 2023 at 10:28:44AM -0400, gene heskett wrote: > I cannot make bashes redirection (cmd 2>&1 >tmp/cmd.log) work in Konsole. > What terminal actually uses bash for the heavy lifting? The terminal is irrelevant. This is entirely done in the shell. Your redirectio

Konsole is not bash

2023-08-20 Thread gene heskett
I cannot make bashes redirection (cmd 2>&1 >tmp/cmd.log) work in Konsole. What terminal actually uses bash for the heavy lifting? Cheers, Gene Heskett. -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed

Re: Bootloader error grub minimal bash "load the kernel first" after installing my live image via calamares installer

2023-08-14 Thread Thomas Schmitt
minimal bash "load the kernel first" after installing my live image via calamares installer Thanks for the reply. I tried debian di too but wasn't successful in that either it said that the kernel version for live and installer were not the same. - End forwarded message - T

[sakkrabi...@gmail.com: Re: Bootloader error grub minimal bash "load the kernel first" after installing my live image via calamares installer]

2023-08-13 Thread Andrew M.A. Cater
- Forwarded message from Sakkra Billa - Date: Sun, 13 Aug 2023 21:35:33 +0530 From: Sakkra Billa To: "Andrew M.A. Cater" Subject: Re: Bootloader error grub minimal bash "load the kernel first" after installing my live image via calamares installer

Re: Bootloader error grub minimal bash "load the kernel first" after installing my live image via calamares installer

2023-08-13 Thread Thomas Schmitt
settings-debian and .rsync . The live image works perfectly So the aim of the tutorial was achieved. > and the installation also finishes > without errors but when i reboot my VM into the installed environment, it > boots into grub minimal bash line editing mode. On typing boot it says

Re: Bootloader error grub minimal bash "load the kernel first" after installing my live image via calamares installer

2023-08-13 Thread Andy Smith
Hi, On Sun, Aug 13, 2023 at 06:56:08PM +0530, Sakkra Billa wrote: >when i reboot my VM into the installed environment, it boots into >grub minimal On typing boot it says "load the kernel first". What kind of VM is this? Which provider, if you are unsure. Cheers, Andy -- https://bitfolk.com/

Re: Bootloader error grub minimal bash "load the kernel first" after installing my live image via calamares installer

2023-08-13 Thread Michael Kjörling
On 13 Aug 2023 18:56 +0530, from sakkrabi...@gmail.com (Sakkra Billa): > but when i > reboot my VM into the installed environment, it boots into grub minimal > bash line editing mode. On typing boot it says "load the kernel first". Sounds to me like GRUB can't find grub.cf

Re: Bootloader error grub minimal bash "load the kernel first" after installing my live image via calamares installer

2023-08-13 Thread Andrew M.A. Cater
an and rsync . The live image works > perfectly and the installation also finishes without errors but when i > reboot my VM into the installed environment, it boots into grub minimal > bash line editing mode. On typing boot it says "load the kernel first". I > did not change any of

Bootloader error grub minimal bash "load the kernel first" after installing my live image via calamares installer

2023-08-13 Thread Sakkra Billa
errors but when i reboot my VM into the installed environment, it boots into grub minimal bash line editing mode. On typing boot it says "load the kernel first". I did not change any of the calamares settings everything is default. Please guide me that where did i go wrong.

Re: bash $MAIL bug in Bookworm

2023-08-09 Thread tomas
mail' message appears when it should not. In the example below I pressed TAB > after the letter 'T' (which gave me expansion 'TODO'). I am running bash. > > $ me TYou have mail in /var/spool/mail/addw > ODO You can always look for bugs filed against a package in the packa

bash $MAIL bug in Bookworm

2023-08-09 Thread Alain D D Williams
me expansion 'TODO'). I am running bash. $ me TYou have mail in /var/spool/mail/addw ODO Should I report this elsewhere ? Regards -- Alain Williams Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 https://www.phcomp.co.uk

  1   2   3   4   5   6   7   8   9   10   >