Questions tagged [bash]

Bash (Bourne-Again SHell), is the default interactive user shell used in Ubuntu. Use this tag for questions specific to Bash, as opposed to generic POSIX shells.

Filter by
Sorted by
Tagged with
0 votes
1 answer
31 views

xfconf-query not working in crontab

i have a script as follow /usr/bin/disable-sleep #!/bin/sh xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/blank-on-ac -s 0 now=$(date +"%D %T") echo "disable sleep $now&...
Hans Yulian's user avatar
-1 votes
0 answers
14 views

Node / javascript script can't detect my node & npm versions and fails

I'm trying to run setup for Epic React. The script includes this: var spawnSync = require('child_process').spawnSync // [removed: ... a bunch of useless stuff about colours] console.log(color('info',...
Rin and Len's user avatar
0 votes
0 answers
132 views

Adapt systemd-resolve command to resolvectl

I upgraded my ubuntu to 22.04 and a script that routes the traffic of my work vpn is not working properly since it uses a systemd-resolve command. How I use the script: I manually execute a script (...
Naxxio's user avatar
  • 1
-1 votes
0 answers
29 views

How to print command and then 5 live lines of command?

When I'm building a docker image, it prints the current RUN command, and a 5 or 6 line summary with the latest live output from that command. Is there an easy way to do this but for a bash script? I ...
Rafaelo's user avatar
  • 133
0 votes
1 answer
81 views

Bash script does not recognize commands (Perl and Python scripts)

I have this script in bash inside which is defined to use perl and python for subprograms that need to analyze my data. Script is executing fine until Step3 and Step4 and crashes with command not ...
Maja Mucko's user avatar
3 votes
2 answers
775 views

How (abc) is parsed in bash

I'm using a program designed for windows that I compiled myself for GNU/linux. The program works in the command line, and one argument looks like this: prgm -arg1 abcd(10)(22) -i files.ext Where (10) ...
JRR's user avatar
  • 195
-2 votes
1 answer
43 views

cli commands to fetch and set ubuntu settings? [duplicate]

Is there a pair of 2 commands that I can use to 1. store the current ubuntu settings (the ones that you can change by going to the top right and clicking settings) into some kind of my_settings file, ...
user56834's user avatar
  • 109
0 votes
1 answer
38 views

Exit cron job after launching program

I have this .sh script that I want to execute once a day as a cron job. It checks if a specific process is still running (qbittools) and if not launches it again. This works, however the cron job ...
cmplieger's user avatar
  • 101
0 votes
0 answers
55 views

Unable to resume from suspend due to zsh as default shell - why?

I've been bothered by a problem where my workstation won't resume from suspend. When the PC is powered the power button is fully lit, and when it's suspended the button is blinking. Pressing the power ...
Blair Frandeen's user avatar
0 votes
1 answer
24 views

`expr: non-integer argument`

num1=20 num2=5 echo $( expr $num1 + $num2 ) I ran this code but it shows this error message. What can I do to solve this?
dhebbie Godspride's user avatar
-1 votes
0 answers
29 views

Adding chapters to mp4 using bash script and ffmpeg

I'm trying to add chapters to an mp4 file using bash and ffmpeg. The chapters are located in a file called chapters.txt. When the bash script is run which is called add_chapters.sh it reads the ...
Rick T's user avatar
  • 2,191
0 votes
1 answer
37 views

Why is my .bashrc caching curl when using as command substitution $(curl -s http://someurl.com)? [duplicate]

Here is an alias I made on my ~/.bashrc: alias rand="echo $(curl -s https://whatthecommit.com/index.txt)" If you enter this url, it simply returns a random message every request, as ...
João Hamerski's user avatar
0 votes
0 answers
47 views

Running OpenFoam command: paraFoam -> Error 420: paraView: not found

I have lately installed OpenFoam v.2212.0 on UBUNTU 22.04.0. All the other OpenFoam commands work fine for me, but as soon as I type "paraFoam", I get the following error: Invalid $...
Lt Ark Angel's user avatar
0 votes
0 answers
39 views

grep Not Displaying Results Due To Apparent Garbage Characters In File

I have a file which I have removed all ^M from each line. I can vi the file fine. Here are the first few lines I see in vi after issuing "vi filename": USE [master] GO /****** Object: ...
slashusr's user avatar
0 votes
0 answers
12 views

How should this sed command be rewritten to avoid an unterminated 's' command error? [duplicate]

I'm slowly following along with a Linux certification textbook just to bolster my skills a little. Text stream processing is the current topic, and the command I'm working with out of the book uses ...
runujhkj's user avatar
0 votes
0 answers
20 views

./docker-build.sh: ./mvnw: /bin/sh^M: bad interpreter: No such file or directory [duplicate]

I am using Ubuntu 22.04 File docker-build.sh #!/usr/bin/env bash if [ "$1" = "native" ]; then ./mvnw clean -Pnative spring-boot:build-image --projects book-service -DskipTests ...
Vy Do's user avatar
  • 489
0 votes
1 answer
60 views

Loop through file extension Annotate add EXIF Rename and Copy

This script, reads user input from an entry like filename.jpg it creates a directory inside the current directory. Then renames the file and adds the files EXIF data it then copies the original file ...
Off Grid's user avatar
0 votes
1 answer
160 views

In Ubuntu is there a way to configure PS1 so that it does not update the window title?

Question I have a script called title which sets the title bar for a UNIX window, it's simple and just echos an escape sequence. See https://askubuntu.com/a/22417/323009. #/bin/bash ESC=$'\e' BELL='$'...
PatS's user avatar
  • 113
0 votes
0 answers
18 views

Loud static voice.Echo cancellation script [closed]

Does anyone know which distro won't give me this problem? I am using Linux Lite latest version,and every time I try to use the echo cancellation which I added by using this script load-module module-...
Windows Sucks's user avatar
0 votes
1 answer
105 views

Tilde not working on Ubuntu I installed on Windows 11

I installed Ubuntu on my Windows 11 and I've been trying to use Tilde on the terminal, but it keeps giving me an error. cd ../Pictures takes me to the Pictures directory, but cd ~/Pictures says: No ...
Ufedo Akoje's user avatar
-1 votes
1 answer
108 views

Rename and add a number to all folders in a directory

I have a simulation folder on hpc which contains time directories from 0 to 50 with a step of 0.1 (so 501 folders in total with their names as 0, 0.1, 0.2.. and so forth). Example output of ls: 0 0.1 ...
rku's user avatar
  • 13
-3 votes
1 answer
58 views

inotifywait does not work for one glob pattern, but works for others

This is my scripts: #!/bin/bash . Load inotifywait -m \ /Base/Qwik/**/*.jsx \ /Project/Web/src/Components/**/*.jsx \ /Project/Web/src/routes/**/*.jsx \ /Project/Web/src/routes/*.jsx \ -r \ -e modify ...
Saeed Neamati's user avatar
0 votes
0 answers
37 views

Cant autocomplete "unzip"-command

When I try to use the command "unzip " on any folder I immediately get the line unzip ls: cannot access 'tmp': No such file or directory ls: cannot access 'tmp': No such file or directory ^C ...
anon's user avatar
  • 1
0 votes
0 answers
54 views

Su: Failed to execute

I'm new to Linux, and I followed the tutorial on the internet to install zsh then I went into root by typing sudo su then after that I installed zsh in the terminal and after installing I typed chsh -...
Rafi Muhammad's user avatar
0 votes
0 answers
44 views

Script to kill procees in boot not working

Everytime i boot my computer i run: sudo lsof -i -P -n | grep LISTEN then look for the PID of 'mysqld' and run 'sudo kill [PID]' I tried with this script (I also open docker desktop on startup), but ...
elunicotomas's user avatar
0 votes
0 answers
39 views

How to configure Bash to use lsd for tab-completion?

For the sake of the question, assume I'm on the most-recent (stable) LTS release of Ubuntu. I've installed a replacement for the ls command. In this case, that replacement is lsd. The same question ...
cocomac's user avatar
  • 3,093
-1 votes
0 answers
37 views

Bash alias for a variable name [duplicate]

How do we have Bash alias for variable name e.g. VAR=99 alias n=VAR echo $n # should show 99 but can't One sincerely help
itil nonok's user avatar
0 votes
0 answers
15 views

after each reboot I need to assign swap manually and /etc/rc.local doesn't get triggered

After every reboot, I'm just seeing one swap in my system. $ sudo swapon --show NAME TYPE SIZE USED PRIO /swapfile file 2G 0B -2 So in /etc/rc.local I've put this piece of instruction: # ...
Maifee Ul Asad's user avatar
0 votes
0 answers
45 views

No output of ps and netstat on Ubuntu 22.04 server

It just happened that ps and netstat output nothing. How can I make it print on console? Environment: root@server3-8x64:~# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu ...
Frank Wen's user avatar
0 votes
0 answers
18 views

Screen logs and launching script at boot (/profile.d vs /init.d)

I had a script file (myScript.sh) with the following contents in /etc/profile.d with the to launch at start/reboot. It worked well - no issues. #/bin/bash screen -dmS p1 /home/pi/process1/process1d.sh ...
SEU's user avatar
  • 139
0 votes
0 answers
25 views

Ubuntu directory permissions to share

Assume we have a path /path/to/usera/data, its owner is user_a and Now we want to share this dir to user_b with following steps: add a group datashare and add user_a user_b to it sudo groupadd ...
zhang's user avatar
  • 111
16 votes
7 answers
4k views

Can we prevent a command from being executed for root in Linux?

There is this script that is difficult to read and debug. Somewhere in it, it has commands like this: sudo chmod -R 777 /$some_var/$another_var In other words, it creates a path dynamically, and then ...
Saeed Neamati's user avatar
1 vote
1 answer
69 views

Create a bash function with parameters to use as an alias

I have realised that my folders follow a specific structure and wanted to access them with cd faster, so I tried to make this alias / function that would behave like this: cdc glm 03 would be ...
Uladzimir Treihis's user avatar
1 vote
2 answers
86 views

Where can I add to the ***universal*** path?

I'm a script kiddie of sorts and enjoy writing bash scripts for things, and I keep them in a repository that I synchronize, and on my personal computers I keep it in a home/otherStuff/customBin folder,...
Jrome's user avatar
  • 13
0 votes
0 answers
23 views

Bash sourced files work properly after initial input into terminal

I am messing with my bash setup, and I decided to move it to version control, I made a couple of changes, and moved the .bashrc and .bash_profile to my dotfiles repo. This seems to have caused quite ...
Nikola-Milovic's user avatar
0 votes
1 answer
110 views

What does this command mean: `echo $line | awk -F "\t" '{print $1;}'`?

I'm new to this, and I was wondering specifically what awk -F "\t" means.
spjvn's user avatar
  • 1
0 votes
0 answers
21 views

How to set a desktop file in an installation script running as root to "allow launching"

I try to set a desktop file into the "allow launching" state in my installation script running as root. I tried following different ways to get it done: gio set "/home/ubuntu/...
framp's user avatar
  • 101
1 vote
1 answer
138 views

Two-way pipe in bash?

I have a binary who's stdout is being redirected to the stdin of a python script, and I was wondering if there's any way to send the stdout of the python script to the stdin of the binary, to get an ...
SpaghettiMan's user avatar
0 votes
1 answer
77 views

Terminal always shows these extra lines after being opened

I am using Kubuntu 22.04.3. Whenever I open the terminal (or konsole), the following five lines are always displayed. bash: enable: bash: not a shell builtin bash: enable: completion: not a shell ...
Adnan Quaium's user avatar
0 votes
0 answers
29 views

bash install without restart popups

Bash script at bottom, on Ubuntu 22.04. It keeps getting popups to restart services on install, you can see I have tried quite a few approaches. sudo apt update -y and sudo apt install -y libgl1 ...
msj121's user avatar
  • 101
2 votes
0 answers
71 views

How can I update to the latest bash in Ubuntu 22.04.3 LTS?

I am using mcfly (https://github.com/cantino/mcfly). There is a known bug in bash version 5.1 (https://github.com/cantino/mcfly/issues/240, https://lists.gnu.org/archive/html/bug-bash/2022-03/msg00019....
AsGoodAsItGets's user avatar
3 votes
1 answer
111 views

Bash script - new Konsole closing

I'm working on a project that requires me to open some new bash windows to start the docker, server, etc. of the project. I'm trying to make a script so I can start things faster. So far I have this: ...
Matiata's user avatar
  • 33
0 votes
1 answer
87 views

Bash script with different CWD from parent shell?

I'm doing a puzzle for my computer science class where I need to execute the binary /challenge/executable via a shell script, from the CWD of /tmp/exampledir, with the shell's CWD being a different ...
SpaghettiMan's user avatar
5 votes
1 answer
526 views

Use an array as argv?

In a bash script, I'm calling a function with a large number of arguments, say for example /bin/meaningoflife takes 42 arguments. Is there a way I can pass an array to a command instead of manually ...
SpaghettiMan's user avatar
7 votes
4 answers
1k views

How in Bash to test a name/string is an executable

How, on Bash, do we test a name string is an executable, as tried it won't work: $ [[ -x cp ]] &&echo YES $ $ [[ -x ls ]] &&echo YES as tried it hard won't be correct way: $ >/dev/...
itil nonok's user avatar
4 votes
3 answers
199 views

Bash - variable assignment in a pipeline

I am trying to create a script that monitors for failed login attempts and passes the IP address of those attempts as a variable. But I am having a bit of trouble. I have the below command which spits ...
Apollo's user avatar
  • 41
-4 votes
1 answer
63 views

Understanding top command output

Below is screenshot of top command output. I want to understand memory and cpu information in this top's summary view. I have following doubts: Are the numbers for us, sy, ni etc in %Cpu(s) in third ...
RajS's user avatar
  • 153
1 vote
1 answer
140 views

Why can't both Windows and Ubuntu recognize a filename with special characters?

I was trying to append to a text file in bash in WSL (using the >> operator). Unfortunately since I'm a beginner instead of appending to a file, a new file was made with the >> 'text' as ...
KhodeNima's user avatar
-2 votes
1 answer
38 views

how to copy files with some pattern from multiple directories to a single directory?

I have a directory structure base |_folder_34231 | |_23491_this_I_want.csv | |_23491_this_I_dont_want.csv | |_some_other_things_I_dont_need | |...
KansaiRobot's user avatar
0 votes
1 answer
54 views

Not at home after login

I have installed Ubuntu 22.04 in WSL2. I expect that the bash shall be started in the home directory that I find in /etc/passwd as harper:x.1000:1000:,,,,:/home/harper:/bin/bash But after starting ...
harper's user avatar
  • 103

1
2 3 4 5
222