On 08/12/2022 19:34, Ángel wrote:
On 2022-12-07 at 12:38 +, Chris Elvidge wrote:
I don't use Python generally, but my understanding of it (only a
quick test)
f = open("demofile2.txt", "a")
f.write("Now the file has more content!")
f.close()
f.write doesn't a
On 06/12/2022 23:39, L A Walsh wrote:
On 2022/12/06 10:57, Chris Elvidge wrote:
Yair, how about using the Python installed in the WSL instance.
---
Oh, I wondered why Python used CRLF, but nothing else did.
What version of python are you using? The Python for WSL,
the python
there.
Windows text files have to be converted to Linux format before
processing - either inline (tr -d '\r') or in mass (dos2unix).
Expecting bash to cope is a non-starter.
Yair, how about using the Python installed in the WSL instance.
--
Chris Elvidge
England
On 28/03/2022 22:00, Greg Wooledge wrote:
Or -- and I know this answer will be rejected, because it's too simple
and sensible -- stop using aliases in scripts.
+1
Or could just stop answering questions about aliases in scripts
--
Chris Elvidge
England
blabla
EOF
)
This would break backward compatibility and POSIX compliance.
I'm sure there are real life scripts that have leading spaces in their
here-doc payloads which should be preserved.
Yes there are.
--
Chris Elvidge
England
err and stdout to
`/dev/null'.
Oğuz
If you want to parse them as two separate commands, separate them.
--
Chris Elvidge
England
On 29/03/2021 12:04 pm, ილია ჩაჩანიძე wrote:
How can I set default PS1 variable from source code?
E.g I want it to display:
My-linux-distro $
And not:
Bash-5.1 $
Set it in $HOME/.bashrc
--
Chris Elvidge
England
$PWD
If you want to register the current directory in $PS1 regardless, change
\w to `pwd`
--
Chris Elvidge
England
the
necessity of an additional explanation...
Thank you for the comment!
--
Koichi
--
Chris Elvidge
England
that used on old-hardware terminals.
Thanks,
-l
Try Ctrl-V before hitting .
--
Chris Elvidge
England
z
But ${var^} still doesn't know that it should apply to the first alpha
character in a string. Similar for , and ~. If the first character of
the string is a punctuation character, e.g.(, it doesn't work (as I
would like it to ).
--
Chris Elvidge
England
to check if version X-1 is being used and throw an error
there. Isn't that what $BASH_VERSION / $BASH_VERSINFO is for?
--
Chris Elvidge
England
.ch/>
From man bash:
((expression))
The expression is evaluated according to the rules described
below under ARITHMETIC EVALUATION. If the value of the
expression is non-zero, the return status is 0; otherwise the
return status is 1. This is exactly equivalent to
let "expression".
o you choose for the first expansion?
Thanks for the suggestion.
--
Chris Elvidge
England
rithmetic context) of [...]
connected/related? Or am I (stupidly) seeing a connection where none
really exists?
Thanks
--
Chris Elvidge
England
On 06/07/2020 12:50 pm, Greg Wooledge wrote:
On Fri, Jul 03, 2020 at 07:00:54PM +0100, Chris Elvidge wrote:
I've used 'return $((!$#))' and 'return $[!$#]' to return an error if no
parameters given to function.
The problem with this is that it *always* returns from the function,
even when
On 03/07/2020 11:16 pm, Eli Schwartz wrote:
On 7/3/20 2:00 PM, Chris Elvidge wrote:
I've used 'return $((!$#))' and 'return $[!$#]' to return an error if no
parameters given to function.
Tested in a bash script 'exit $((!$#)) / $[!$#]' - both work.
'echo $((!$#)) / $[!$#]' - both echo 1 when
On 03/07/2020 10:39 pm, Lawrence Velázquez wrote:
On Jul 3, 2020, at 2:00 PM, Chris Elvidge wrote:
However 'N=0; echo $((!$N))' gives an error at the bash prompt.
'echo $[!$N]' echo's 1 as expected.
My question - is $[...] actually obsolete?
It might tell you something
On 03/07/2020 11:16 pm, Eli Schwartz wrote:
On 7/3/20 2:00 PM, Chris Elvidge wrote:
I've used 'return $((!$#))' and 'return $[!$#]' to return an error if no
parameters given to function.
Tested in a bash script 'exit $((!$#)) / $[!$#]' - both work.
'echo $((!$#)) / $[!$#]' - both echo 1 when
On 03/07/2020 10:39 pm, Lawrence Velázquez wrote:
On Jul 3, 2020, at 2:00 PM, Chris Elvidge wrote:
However 'N=0; echo $((!$N))' gives an error at the bash prompt.
'echo $[!$N]' echo's 1 as expected.
My question - is $[...] actually obsolete?
It might tell you something
the same effect?
Cheers
--
Chris Elvidge
21 matches
Mail list logo