Questions tagged [bash]

Bash (Bourne-Again SHell), is the shell used in Ubuntu's command-line interface by default.

Filter by
Sorted by
Tagged with
0 votes
0 answers
9 views

In thе fоldеr, сrеаtе а bаsh sсript thаt $CITY

In thе fоldеr, сrеаtе а bаsh sсript thаt: cоllеcts аnd displаys infоrmаtiоn аbоut thе systеm (distributiоn vеrsiоn, kеrnеl vеrsiоn, numbеr оf prоcеssоr cоrеs, аmоunt оf RАМ); writеs thе cоllеctеd ...
user avatar
0 votes
0 answers
13 views

Making two lists, matching and not-matching specific file types

I have a bash function where the arguments are files. Thus the following print statement gives opts="$@" echo "$fargs" Result: linge-cellar.rc linge-cellar.rc~ linge-checkn.rc ...
user avatar
  • 1
2 votes
3 answers
42 views

How can I capitalise a word proceeding a specific word

Lets say I want to capitalise the first word following the word jumped. Example below Original text: the cow jumped over the moon Amended text the cow jumped OVER the moon I have tried awk and sed ...
user avatar
0 votes
1 answer
20 views

How to get the average ping time?

Here's a real result of my ping 192.168.1.1 command: 64 bytes from 192.168.1.1: icmp_seq=964 ttl=64 time=1018 ms 64 bytes from 192.168.1.1: icmp_seq=965 ttl=64 time=921 ms 64 bytes from 192.168.1.1: ...
user avatar
0 votes
0 answers
44 views

bash script for grep with context

Am writing a bash script that uses grep to search phrases and prints them on terminal. I want the user to have the possibility of using the context options of grep (-C, -A, -B). I made an indexed ...
user avatar
  • 27
0 votes
0 answers
19 views

Cannot run ./configure from source code

I downloaded the latest coreutils source code (coreutils-9.1.tar.xz) from https://mirrors.kernel.org/gnu/coreutils/ to slightly modify the output of the ls command to simply print Hello there you ...
user avatar
1 vote
3 answers
690 views

why there is two identical bash?

I have seen some bash scripts start with /user/bin/bash and others/bin/bash I did a check-sum with cksum 2695035772 1392424 /usr/bin/bash 2695035772 1392424 /bin/bash they look exactly the same, so ...
user avatar
-1 votes
0 answers
20 views

About command line syntax in an .sh shell file [duplicate]

I confess, I have been using GUI interfaces for a few decades. I have gotten used to Microsoft Windows Operating Systems and I have not spent enough time navigating all of the command line commands......
user avatar
  • 107
1 vote
1 answer
19 views

insert variables from 2 files based on 1 row

I have 3 source files. 1.txt - template. <field name="COL1" label="COL2" data-source="COL1" classes="attribute" category="Attribute"/> 2.txt - ...
user avatar
  • 766
0 votes
1 answer
18 views

Getting error while executing PowerShell cmdlet on ubuntu machine

I was currently running PowerShell on ubuntu machine with the help of VS code by importing packages. The commands which I used are: sudo apt update; sudo apt-get install libunwind8; wget https://...
user avatar
  • 1
0 votes
0 answers
28 views

Command lnd not found even after installing lnd

I tried installing lnd using the commands shown in the installation guide. I used these commands: git clone https://github.com/lightningnetwork/lnd cd lnd make install but when I try running the lnd ...
user avatar
0 votes
2 answers
45 views

How to roll back or uninstall a script ran from wget piped to bash?

I piped the following script to bash using wget with the intention of installing a theme for bash. wget -O - https://teejeetech.com/scripts/jammy/tweak_terminal | bash Now I cannot find a way to roll ...
user avatar
0 votes
0 answers
18 views

Switch to zsh only for current user after ssh into remote server using sudo?

As title. I just sshed into my lab's server and it's Ubuntu 20.04 LTS. But I'm a macOS user and I have gotten used to zsh, but the shell of the Ubuntu 20.04 LTS server defaults to /bin/sh. My current ...
user avatar
  • 101
0 votes
0 answers
22 views

bash variable substitution to remove the start [ and final ]

I am using substitution to remove the start [ and final ] from strings such as "[abc]" as follows. braces="][" letter="[abc]" ltr="${letter//[$braces]/}" But ...
user avatar
  • 27
0 votes
1 answer
33 views

does case statement require a break command eventually

Does a case statement always need a break statement eventually? Otherwise it looks as if one ends up with an infinite loop.
user avatar
  • 27
2 votes
2 answers
470 views

Check if process does or does not exist

I want to write script that accepts process name (I ask the user for process name each time followed by a prompt on the same line) if process exists it will print "EXISTS" or if it doesn't ...
user avatar
0 votes
0 answers
64 views

Why can't I paste multiple sudo commands in Ubuntu 22.04?

I just installed Ubuntu Server 22.04 and SSHed in. I'm not able to paste multiple sudo commands as I could with Ubuntu Server 20.04. This feels to me like a security feature that I don't want. ...
user avatar
  • 197
0 votes
0 answers
16 views

Handling bad values when parsing function arguments in bash

I want to handle bad values when parsing function arguments in bash. What can I do? Bad values for -v (not 1,2 or 3) makes the function go wrong when parsing arguments. myfunc -v 1eo -g -W 3 Here is ...
user avatar
  • 27
-4 votes
0 answers
48 views

when I type "cd Desktop" in Kali Linux terminal, it shows "no such file or directory"; what should I do? [closed]

when I type cd Desktop it shows No such file or directory. root@<username>:/home/kali# cd root@<username>:~# cd Desktop/ bash: cd: Desktop/: No such file or directory What to do now ?
user avatar
0 votes
1 answer
17 views

How to open command on second tab in bash terminal [duplicate]

So I am writing a script and I want to export a log but open the tail command in another tab. So far this is what I have come up with in BASH. ./configure &> log.configure.txt && gnome-...
user avatar
  • 85
-1 votes
1 answer
18 views

Removing enclosing [ ] in bash strings

I have bash strings enclosed by [], e.g. [name], [surname]. And want to remove the starting [ and closing ]. What can I do?
user avatar
  • 27
0 votes
0 answers
25 views

How to execute a command on a single file in a directory whilst looping though the directories recursively

I have the following structure / Cardio /../ High /../ High / download.txt /../ Low /../ Low / download.txt /../ Medium /../ Medium / download.txt / Warm / Warm / download.txt / Cool / Cool / download....
user avatar
  • 131
0 votes
0 answers
48 views

Rename all files and directories wihtin a directory to uppercase

So, i have a game folder (for example, named: GAME1) which contains 250000+ files and directories. Everything inside needs to be renamed from lowercase to uppercase . I can open a single directory (A) ...
user avatar
-1 votes
1 answer
41 views

Do you need to update VLC first before installation?

I am trying to use commands to update or install VLC on Linux. I am trying to use sudo apt install vlc or sudo apt update vlc but these commands seem like they are not working.
user avatar
0 votes
0 answers
17 views

Adding language failure in terminal and system KDE (kubuntu)

I was trying to add Spanish as a secondary language for spellcheck reasons via GUI, there is a bug that doesn't allow me to actually download the language so I tried the following command: sudo apt-...
user avatar
4 votes
1 answer
259 views

Unknown error in someone else's code

I am trying to install a program, and I keep getting this error message when trying to configure it: /configure: 919: [: unexpected operator I looked in the code, and this is what is located in that ...
user avatar
  • 85
1 vote
1 answer
42 views

bash: mp3chaps command not found

i try to run mp3chaps command like mp3chaps -i episode_42.mp3 but terminal return me this error bash: mp3chaps command not found I'm pretty sure I have mp3chaps installed, I tried use also this too ...
user avatar
3 votes
2 answers
174 views

Trying to uncomment unattended-upgrades lines with script, need help

I've recently started working as an IT person in a all Linux company, and noticed some of the tasks we do can be 'easily' automated. Today's task to automate is installing software and configuring /...
user avatar
0 votes
1 answer
35 views

How can I change all these settings from my Ubuntu Bash Terminal?

I have Ubuntu 20.04 system. My windowing system is X11. Here is my settings dialog box : I have often noticed that I can't change all the settings from terminal alone. I have to use the mouse many ...
user avatar
1 vote
1 answer
30 views

Terminal Appearance Problem

linux noob here. I'm configuring the appearance my terminal via some commands like: vi $HOME/.bashrc then add do this command export PS1="\e[0;32m[\u@\h \W]$ \e[m " and now my terminal ...
user avatar
2 votes
3 answers
177 views

Removing a variable pattern from the title of my files

As I finally received data from NGS sequencing, for some days I used Ubuntu to analyse them. However, I lack the basics of shell coding, and I feel overwhelmed by this whole new language. I managed to ...
user avatar
0 votes
0 answers
28 views

Linux (Ubuntu 18.04) ssh connection closed after login with -bash Input/Output errors

Currently running into an issue when SSH'ing into a remotely deployed edge computer. When logging in via SSH after entering the password the connection is closed, output of the terminal below: Welcome ...
user avatar
  • 1
0 votes
0 answers
19 views

Init Script is failing?

I am using a init script for databricks cluster and the below is the script: #!/bin/bash apt-get -y update && apt-get install -y libudunits2-dev libgdal-dev libgeos-dev libproj-dev This ...
user avatar
  • 1
-4 votes
0 answers
71 views

Matching colour format in bash [closed]

I have the following \033[21;41;32m and want to have a regex to matches. if [[ $1 =~ \[ ([0-9]+\;){2}[0-9]+m ]] I think the regex expression should match [0-9]+\;, then match the last number with [0-...
user avatar
  • 27
0 votes
0 answers
140 views

Issue with Linux multi user creation using bash script

As per our requirement we provided our devloper group: devs:r-x to /var/log/httpd directory. Now I'm creating a Linux function , which take the developer's first name and create a linux user in our ...
user avatar
0 votes
1 answer
21 views

Bash script to automate codec installation

I recently moved from Ubuntu 20.04 to 22.04. I don't keep any media files but when I visited youtube I discovered no audio was playing. After some time I came to (guided)conclusion that I need to ...
user avatar
1 vote
1 answer
57 views

lsb_release error: bash: /usr/bin/lsb_release: /usr/bin/python3: bad interpreter: No such file or directory

After upgrading to Ubuntu MATE 22.04 Jammy from Ubuntu MATE 21.10 Impish, when I run lsb_release I'm getting this error: $ lsb_release bash: /usr/bin/lsb_release: /usr/bin/python3: bad interpreter: ...
user avatar
  • 1,811
0 votes
0 answers
31 views

Script to show free memory (Ram) column on `free` command in linux?

I want to write a script that shows available memory in my system every second with the updated value. I have some clues like I can use the free command with the -m option to show in megabytes. I have ...
user avatar
0 votes
1 answer
36 views

Is there a way to exit a while loop without Ctrl+C (bash)

I'm trying to run a simple loop that while the condition is true it sends some logs to the system. example: while sleep 1800; do top -b > /path/to-file.txt ping xx.xx.xx.xx > /path/to-file2....
user avatar
  • 1
1 vote
0 answers
13 views

What is the first line of the output of `ldd bash` and why is not required when setting a new root directory to use with chroot?

I am following a tutorial about how to use chroot and set up a jailed dir. The process is to copy bash and the libraries it depends on into the 'jail' dir. To find the libraries bash depends on I ...
user avatar
  • 51
-3 votes
1 answer
48 views

Printing with colour codes

I want to write some text in colour from a bash script, but the string " -s, --with-sequence" is not getting printed. local rc="\e[0m" local bfcode="\033[0;49;33m" local ...
user avatar
  • 27
0 votes
0 answers
10 views

Validity of local variable declaration

Is these valid local variable declarations in a bash script? local jf=$1 rc="\e[0m" iq=8 bfcode frmt local jf=$1 rc="\e[0m" bfcode frmt iq=8
user avatar
  • 27
-1 votes
1 answer
16 views

Looping with number series

I have made a loop in a bash script for kr in {0..9} ; do I want to also get kr to include the number 20.
user avatar
  • 27
2 votes
1 answer
32 views

printf statement with background and foreground colours

I know that a background colour code is \033[41m, whereas a foreground colour code is \033[32m. I am interested in making a code for changing the background and foreground in a console terminal ...
user avatar
  • 27
2 votes
1 answer
316 views

How does PATH get its contents back after I restart the shell?

Exercise 2 from Missing Semester asks the following: Run PATH= and try running the previous commands again, some work and some don’t, can you figure out why? Setting PATH= removes all the contents ...
user avatar
  • 153
0 votes
0 answers
31 views

Setting variables in bash

I am setting the value for iq in a bash script, but the value of iq is not being displayed. local divisor=5 iq=$divisor echo $divisor $iq
user avatar
  • 27
0 votes
0 answers
16 views

Sourcing bash scripts with argument parsing

What happens when one sources a bash script that includes an argument parsing section? I would like to execute functions without having to source the file. But should I source the file, I do not ...
user avatar
  • 27
0 votes
1 answer
23 views

Executing bash function from file

I have a bash file with a few functions in it. Is it possible to run a function from the file using the command line?
user avatar
  • 27
0 votes
1 answer
26 views

Starting a simple sh script at reboot? Why is this to difficult? [duplicate]

I've tried everything, I've followed and undone every method I've come across on here but nothing works. I want to run a simple start-up script for an executable upon reboot, and no other time, as a ...
user avatar
0 votes
1 answer
37 views

how to code this animated string in bash better and simpler?

clear echo "loading" sleep 0.6 clear echo "Loading" sleep 0.6 clear echo "lOading" sleep 0.6 clear echo "loAding" sleep 0.6 clear echo "loaDing" sleep ...
user avatar

1
2 3 4 5
209