Questions tagged [bash]
Bash is a free shell for Unix-like operating systems from the GNU Project.
11,762
questions
0
votes
0
answers
91
views
While invoking bash without options -c or -s the first argument is a filename, how to execute it sourced? [duplicate]
While invoking bash without options -c or -s the first argument is a filename (see manpage bash).
In such a case bash executes that file and exits.
I just need this feature, yet that file has to be ...
0
votes
0
answers
87
views
Using ffmpeg and concat demuxer producing weird video navigation behaviour
When combining multiple videos segments, each encoded with H265 and Vorbis and containing the same number of streams and frame rate, I use:
ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mkv
...
1
vote
0
answers
60
views
Spliting video with ffmpeg producing wrong durations
I'm currently using a framework where I have to split a video (originally encoded with HEVC video and AAC audio) in multiple parts to process them separately. Then the final result is obtained by ...
0
votes
1
answer
347
views
sudo passwd for bash terminal
I am total newbie so excuse the lack of knowledge, but I recently created an Microsoft Azure account so it comes equipped with a bash terminal. I wanted to make sure it is up-to-date so I tried ...
0
votes
1
answer
134
views
File system contents sometimes not synced in some bash terminals
I've sometimes noticed this behavior on one machine (Ubuntu using Mate terminal).
Case 1
I have 2 terminals open on the same path. I do a 'ls' on both but the output is incorrect in one of them, some ...
0
votes
0
answers
77
views
How on MacOS from bash script (or installer) inform system restart is requried (which can be postoned by a user)
I have some post installation script which on some version of MacOS system does some system tweaks. This changes will take effect when system is restarted.
I do not want to restart machine immediately....
0
votes
1
answer
103
views
linux + why command output cant be filter or can saved in file
clockdiff is command that measure clock difference between hosts
here is example from my Linux machine.
clockdiff -o 162.23.2.2
.
host=server11 rtt=750(187)ms/0ms delta=0ms/0ms Tue Oct 24 11:01:42 ...
2
votes
2
answers
311
views
I want to get every command that has 3 letters and only three letters
I don't get the output I expect using apropos -k . |awk '/^.../ {print $1}' am I completely overthinking this? In this sample output only zsh should have come back.
I also tried this
apropos -k . | ...
0
votes
2
answers
88
views
switching from one directory to another directory with same name different path in command line
In Linux, I have two directories (just an example, this structure exist for every project checkout):
/root/user/<project>/<parent_directory>/<long path>/test
/root/user/<project&...
0
votes
1
answer
24
views
Use atrun via launchD on MacOS
I'm trying to schedule a job using the at-command in a script invoked by a launchDeamon.
This doesn't seem to work.
The launchD for atrun is running.
Atrun, cron and terminal all have full disk access....
1
vote
1
answer
902
views
The most proper place to set systemwide shell alias in a Linux system
There are many places to set an alias for all users within a Linux system,
e.g. /etc/profile, /etc/profile.d/*, /etc/bash.bashrc...
I'm wondering which one is the most proper/correct, in other words, ...
0
votes
1
answer
40
views
Part of string missing while concatenating 2 string variables
I am using Bash version 5.0.17 on Ubuntu.
I am trying to append a date and time (based on the file's modified date) to a filename for backup purposes.
I create the substring to append by doing the ...
-1
votes
1
answer
52
views
tsunami windows 10 curl java home environment variable error
I am setting up tsunami on Windows 10. I am following the tutorial (https://github.com/google/tsunami-security-scanner). When I run the bash command, I get the following error:
ERROR: JAVA_HOME is not ...
0
votes
0
answers
164
views
Shell script run by launchd in MacOS can't create at job
I'm using the privileges.app to grant users temp admin privileges.
Because I need to have password auth and justification enabled via config, I can't use the build-in feature to limit the duration of ...
0
votes
1
answer
101
views
Difference between './file' and 'sh file'
On macOS, in the zsh terminal, I ran the following commands:
cd /tmp
mkdir newdir
cd newdir
touch file1
./file1
The last command returned
zsh: permission denied: ./file1
But running
sh file1
executed ...
0
votes
1
answer
245
views
Reboot in middle of bash script
I'm writing a bash script to setup some services in Ubuntu. I require some system reboots between some steps. The problem with this is running reboot interrupts the script as well. Is there a way for ...
2
votes
0
answers
260
views
How can I close a browser window from a bash script?
I would like to open and close windows from a bash script but in my two versions of the code it gets stuck when it opens the first window and does not close the current window and then open the new ...
0
votes
2
answers
284
views
using bash to process a text file that consists of path names
I need some help with bash processing of a text file. In my effort to clean up decades worth of windows use I have written a simple command to find all the instances of a specific file - specifically ...
0
votes
0
answers
158
views
cygwin terminal adds carriage return to bash prompt [duplicate]
Running Windows 10. Just installed Cygwin, running it in Windows Terminal, tried to change the prompt format by editing PS1 variable and exporting in .bashrc and .bash_profile:
alias vim='nvim'
alias ...
0
votes
0
answers
27
views
How do I install many lines of packages with apt (from a script)? Does '\' work? [duplicate]
A part of my Bash script looks like this:
apt install -y alsa-base alsa-utils apt-transport-https build-essential curl ffmpeg geany gcc \
gnome-screenshot gnome-terminal libfuse2 libreoffice-calc ...
0
votes
0
answers
2k
views
How to solve exec format error while running container in ECS?
Previously the question was related to https://stackoverflow.com/questions/77266768/yarn-command-not-found-after-successful-docker-build. It was fixed but my problem is related to using shell /bin/sh.
...
1
vote
1
answer
36
views
bash: Can you limit expansion when using pathname expansion?
Let's say I have the following directories:
dir/one
dir/two
dir/three
dir/four
I can use a bash pathname expansion construct like this: ls dir/{one,three}
This will expand as dir/one and dir/three
...
0
votes
1
answer
669
views
How to get PID of python3 working program
I want to write a program on bash that will restart my script once every some time.
The program runs in an infinite loop and launch like this:
Python3 main.py
So to restart it, I need to do
Kill [pid]...
0
votes
1
answer
91
views
SXHKD won't stop running script
So I'm having some difficulty with SXHKD - I run this with BSPWM for context. I recently wrote a script that's able to find all windows in the active monitor, then select the desired desktop from that ...
2
votes
2
answers
705
views
How can I setup ffmpeg to continuously produce 1 second videos from piped jpgs?
I am using ffmpeg on Ubuntu 22.04 to create 1 second mp4 videos from piped jpgs. The only issue that I have is that ffmpeg stops executing after the first set of jpgs is piped in. I need ffmpeg to ...
0
votes
0
answers
118
views
Is there a best way to export from the Directory Utility?
I want to export all of the data from a page in the MacOS directory utility. In the edit section, it say's I'm looking at Users in node /Active Directory/XXXXX/All Domains. It lists all the users I ...
0
votes
0
answers
198
views
Integrate aws-cli via docker to the linux command line
In order not to have too many local installations, I decided to encapsulate the aws and kubectl cli's to a docker container and integrate it via this script, which is accessible on the path:
#!/bin/...
0
votes
1
answer
411
views
mv in script eports "cannot stat"
I'm trying to write a script that adds the last accessed time to the end of the basename. Here is the script:
for f in *.doc; do
DIR=$(pwd)
FILENAME="$f"
FILETYPE=${FILENAME##*.}
...
0
votes
1
answer
2k
views
Where to set env var for Debian12?
There are too many places can hold permanent env var settings in Linux, so that I can't finger out which one is the most correct/proper.
/etc/environments
/etc/bash.bashrc
/etc/profile
/etc/profile.d/...
0
votes
1
answer
89
views
How deep is too deep for Nested Folders in a Bash program?
I am somewhat new to Bash and am writing a program to install .NET SDK and Runtime on each of the available Linux distros.
The problem I am having is that I am trying to source functions from two ...
0
votes
1
answer
900
views
Error code 140 in command running through Nextflow on SLURM
[Note: question heavily edited to correspond to the actual problem]
I'm trying to debug a command that fails only in specific conditions. The failure is with an exitcode 140, but I have no other ...
0
votes
0
answers
111
views
Long line in bash is partially hidden rather than wrapped
When I'm working on a server with a newer OS and bash version via SSH, I find that a long input line is partially hidden. I prefer to see a soft-wrapped line. I don't know if there are some options to ...
2
votes
1
answer
1k
views
Windows Bash Terminal takes over 10 seconds to load
When starting up Git Bash in a Windows terminal or VScode terminal, the screen is blank for 10 - 15 seconds before it initializes to having a working directory and cursor. After init, it runs fine.
...
0
votes
1
answer
498
views
Cannot execute bash script even though +x exists
I'm having trouble getting a gitlab-runner to execute tasks and not sure what I am doing wrong. This is running in Kubernetes but probably not related to Docker or Kubernetes or anything else.
/bin/...
0
votes
2
answers
3k
views
Warning popping up: preload-host-spawn-strategy Warning: waitpid override ignores groups
I am currently on Fedora Linux 38. I have installed VSCode and I have seen warning popping up again and again [337 preload-host-spawn-strategy] Warning: waitpid override ignores groups
Even if I open ...
0
votes
1
answer
614
views
urxvt prompt starts in the middle of screen and tmux shows gibberish when started from it
Lately I noticed that my terminal prompt on urxvt does not start on the first line when I open it, but on the middle of the screen. Also when later I execute tmux command to use tmux inside a urxvt ...
0
votes
1
answer
531
views
Moving files to a directory with spaces in its name
I'm trying to create a directory that has in its name the beginning of the names of the files it contains. I need this in order to archive it later. I have run into problems when moving files if the ...
1
vote
2
answers
385
views
How to add a pause between lines in a multi-line paste into Telnet terminal on Bash?
I am using the telnet command on a Bash terminal in Linux to connect to a Console of a firmware running on an embedded system. The FW is controlled via console commands. To make things easier, I ...
0
votes
0
answers
48
views
How to combine 2 rsync outputs into 1 command?
using:
neofetch --stdout |grep 'OS:'
OS: Kubuntu 22.04.3 LTS x86_64
Shell: bash 5.1.16
rsync --version
rsync version 3.2.7 protocol version 31
variables, SourceDisK1 src1 and destination ...
0
votes
0
answers
10
views
sdkman installation fails on raspberry pi [duplicate]
I am trying to use SDKMAN to install java 17 on raspberry pi and the installation seems to work at first, it makes an initial download, but then it intends to Installing script cli archive... and it ...
1
vote
2
answers
443
views
sdkman installation fails on raspberry pi
I am trying to use SDKMAN to install java 17 on raspberry pi and the installation seems to work at first, it makes an initial download, but then it intends to Installing script cli archive... and it ...
1
vote
1
answer
614
views
How do I change the background color for folders in PowerShell when invoking the "ls" command from WSL Interop?
I've installed the WslInterop module and exposed several commands from WSL2.
I'm using Import-WslCommand "apt", "cat", "awk", "nano", "find", "...
1
vote
0
answers
48
views
in bash moved backwards to some previous line, how to get hist line number?
When I have bash history like
101 eoho 1
102 echo 2
103 echo 3
then
history 1
shows
103 echo 3
Now with hitting twice the up-arrow, I have after the prompt the comnand line
echo 1
without the ...
0
votes
3
answers
218
views
bash: How to prevent expand /* in read?
I need to parse some PHP files, and they contain comments like /**/
But:
read line <<< "/*"
echo $line
I want the variable line to have /*, not /bin /boot /cdrom /core /dev /etc /...
0
votes
1
answer
281
views
How to nicely print time difference in bash?
In my bash script, I want to print the time that my set of commands took to execute.
I'm doing this:
#!/bin/bash
start=$(date +%s)
./my-long-command.sh
./another-longcommand.sh
echo "Completed, ...
0
votes
1
answer
117
views
copying tabs from terminal is broken at the text-wrapping edge (the width changes outcome)
The following code will print "a"s up to the terminal width and then a tab character and then a "b". I've tested both Ubuntu's default Gnome terminals and Terminator and they ...
0
votes
1
answer
65
views
sudo for just one command IN lost+found folder, not more
I have this script
# check lost+found folders
function chklnf {
#DOC echo "chklnf - list any files in lost+found folders on mounted devices"
x="lost+found/"
if [ "$EUID" != 0 ] ;then
...
0
votes
2
answers
9k
views
How do I fix "Sudo commands will not succeed by default" on chromeOS Crosh Shell
I have been trying to install SeaBios for Ubuntu, and all of them say I need to use
Crosh Shell, every time I try to use it though it says "Sudo commands won't succeed by default" how can I ...
1
vote
1
answer
87
views
Bash script header for virtual machine
I have a little compiler pet project that generates bytecode for a virtual machine. To run the generated bytecode from the terminal I would always have to invoke the virtual machine with the generated ...
0
votes
1
answer
628
views
Can a linux command auto-login to a specific desktop environment session type
so a bit of context, i have my pc setup to start at TTY then when i want to go into a desktop environment i start the login manager.
# Upon install setting the TTY as default start state
sudo ...