6
votes
Accepted
SSH session termination on script error when sourcing multiple sub-scripts
The reason this is happening is because you are sourcing the master script. I can reproduce the behavior you describe using these two toy examples:
terdon@oregano ~ $ cat ~/scripts/foo.sh
#!/bin/bash
...
3
votes
defining variables inside function
FILE_CORE_NAME="$(/usr/bin/env basename $(/usr/bin/env awk -F "." '{print $1}' <<< "${FILE_TO_PROCESS}"))"; local FILE_CORE_NAME;
Even when reformatted on ...
2
votes
Accepted
Get current directory of last tmux pane
You can use tmux's display-message sub command with -t (target-pane)1 flag. For example you can run
tmux display-message -p -t ! "#{pane_current_path}"
will show details of last pane.
1. ...
2
votes
Accepted
Parsing SQLite output
It appears you simply want to enable CSV output from SQLite:
sqlite> .schema
CREATE TABLE mytable ( field1 text, field2 integer );
sqlite> .mode box
sqlite> SELECT * FROM mytable;
┌──────────...
2
votes
defining variables inside function
local name=value creates a local variable and set it to value. In your case there is no value so you create a local variable which is empty and the local variable hides the non-local variable with the ...
1
vote
I'd like to batch copy files in an special way - Do I need a script?
Doing batch-renaming or copying is a lot easier when you use the zsh shell instead of bash as it comes with a very powerful autoloadable function called zmv:
autoload -Uz zmv # best in your ~/.zshrc
...
1
vote
Accepted
I'd like to batch copy files in an special way - Do I need a script?
Yes, you'd need a script (or something equivalently complex when using other programs). But it will not be long nor hard to understand:
#/------------------------------ for … in … : go through the ...
1
vote
Accepted
Load iptables or nftables rules as fast as possible during boot and before the network interfaces be put online
In Debian 12, iptables is by default a wrapper for the new nftables subsystem. The iptables-persistent package depends on package netfilter-persistent, which creates a service named netfilter-...
1
vote
Easy command line method to determine specific ARM architecture string?
In case dpkg is not installed in your system (for example in lean docker container), this command will helps you
$ arch
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
scripting × 4440bash × 1521
shell-script × 1138
shell × 728
linux × 656
awk × 281
text-processing × 279
sed × 183
files × 174
command-line × 135
ssh × 134
grep × 134
cron × 102
find × 86
variable × 82
ubuntu × 75
terminal × 74
python × 74
perl × 66
rename × 65
ksh × 63
debian × 59
networking × 57
regular-expression × 52
zsh × 51