Skip to main content

Questions tagged [bash]

Questions specific to GNU’s Bourne Again SHell, as opposed to other Bourne/POSIX shells. For questions about Unix shells in general, use the /shell tag instead. For shell scripts with errors/syntax errors, please check them with the shellcheck program (or in the web shellcheck server at https://shellcheck.net) before posting here.

2 votes
0 answers
9 views

What causes this behavior of bash's $COLUMNS variable?

I'm scripting a testing framework in bash and am running into a weird situation. A couple things I'm doing in this post for illustration purposes: Adding echo lines to the scripts; these are not part ...
Targeloid's user avatar
  • 179
0 votes
2 answers
64 views

How can I properly harden my system against some basic exploits like modifications of .bashrc?

I recently read a section on bashrc in the ubuntuusers wiki, in which a possible attack vector for privilege escalation is pointed out. Attackers, or malicious programs, could modify the bashrc or ...
hefe's user avatar
  • 183
0 votes
0 answers
15 views

Setting variable (ORACLE_BASE) for oracle user | Installing Oracle 23

Goal: Install Oracle 23 into /u00/app (and not the default, /opt/oracle). Problem: Oracle installs into /opt/oracle (I assume the variable ORACLE_BASE etc. is not properly set / read for user oracle ...
DavidDunham's user avatar
0 votes
0 answers
22 views

tool or shortcut for copying part of the terminal

I apologize for the vagueness of this question but I saw this tool over 4 years ago at this point. I remember working with a colleague at one point who knew a bash tool or shortcut that allowed him to ...
modernNeo's user avatar
  • 185
2 votes
1 answer
78 views

What is the limit of string size passed to bash -c?

I have the following command echo '123456789#' | xargs -I% bash -c 'echo %%%%%%%%%%%%%%%%%%%%%%%%%' It doesn't expand the last %. Apparently there's a limit on how long the string passed to bash -c ...
gicig's user avatar
  • 121
-4 votes
3 answers
59 views

show which of a list of filenames do not exist in a given list of directories

I have a long list of filenames like 20231121_150111.jpg... in a text file (one filename per line). And another list of directories. Those directories contain files. How can I check and show which ...
user447274's user avatar
2 votes
2 answers
285 views

Remove duplicates in file (without sorting!) leaving the _last_ of the occurences

Following https://www.baeldung.com/linux/history-remove-avoid-duplicates, I added clean_history() { awk '!a[$0]++' $HOME/.bash_history > $HOME/.bash_history.tmp && mv $HOME/....
Make42's user avatar
  • 687
4 votes
1 answer
931 views

Are there alternatives to alias I'm not aware of?

Today I started to notice weird behavior running a local command for a binary installed through Go. It seems the command is aliased, but consulting alias, it isn't. The command buf somehow executes cp!...
Tim's user avatar
  • 1,054
0 votes
0 answers
25 views

Ghost string in terminal, string doesn't go away when using backspace [duplicate]

Linux shell problem on a server, bash 5.1.4(1)-release. Debian 11.10. I have this on my command line right now after pressing the up arrow: server# ctr plugins listkubeadm init --pod-network-cidr=10....
AttributedTensorField's user avatar
1 vote
2 answers
45 views

Need to make multiple multiline replacements in file

I have a file with multiple "paragraphs" like this: <type>TRANS</type> <attributes/> <specification_method>rep_name</specification_method> <trans_object_id/&...
Todd Porter's user avatar
0 votes
1 answer
68 views

How to put all function/command call output results to different corresponding vars: for stderr, for stdout, for string result and for return code?

I want to extend question How to store standard error in a variable and get general solution (bash function or functions) to extract from the called function/command together with standard error also ...
Anton Samokat's user avatar
-1 votes
2 answers
169 views

Is it possible to translate bash to another human language like Arabic?

Bash commands are written in the Latin alphabet, is it possible to translate them to another language? In this case, Arabic. Arabic is written rtl and I remember I tried it using alias before when I ...
Abdelaziz Baheg's user avatar
0 votes
0 answers
18 views

HISTTIMEFORMAT="%F %T " leaves oddly formatted date/time stamps [duplicate]

I am following this page to add date/time stamps to ~/.bash_history. Specifically, I added HISTTIMEFORMAT="%F %T " to my ~/.bashrc. Running exec bash didn't cause the date/time stamp to be ...
user2153235's user avatar
0 votes
0 answers
23 views

Best practice for running Intel MKL-dependent program as a systemd service

We have a systemd service that looks something like [Service] Environment="SOME_VAR=some_value" # etc. ExecStart=/bin/bash -c 'some command' This service file, of course, is templated and ...
Simon Rose's user avatar
0 votes
1 answer
42 views

How to escape symbols in jq query?

I try to get area of JSON created by kubectl as another user. runuser -l username -c "kubectl get ing -A -o json | jq --arg namespace "default" -r '.items | map(select(.metadata....
Aleksey's user avatar
  • 25

15 30 50 per page
1
2 3 4 5
1740