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
0answers
14 views

Ubuntu shell script for starting multiple Postgres servers

I'm fairly new to Ubuntu and I'm tying to write a .sh script that starts up 2 postgres servers. I disabled pw requirement for sudo in /etc/sudoers here is my script so far and it's probably incorrect. ...
0
votes
0answers
19 views

How to direct specific commands traffic to ethernet interface not wifi?

I'm starting to learn networking but I'm having trouble using to direct traffic to eth0. I want to run a command (wakeonlan) and see the traffic in wireshark the problem is that ethernet 802.3 frames ...
0
votes
0answers
36 views

.sh files not executing after upgrade to 21.04

.sh files not executing after upgrade to 21.04. I can run them from within Terminal ok, but not as a self executing file. At this point it opens Notepad++. I have looked in the file properties/open ...
0
votes
1answer
42 views

Remove today's date string from all filenames in folder

I have a folder full of jpegs formatted like this: 0001_20210516_XYZ.jpg 0002_20210516_XYZ.jpg 123_20210516_XYZ.jpg 01_20210516_XYZ.jpg and I want to rename all files so the date string in the middle ...
0
votes
0answers
29 views

how we can append the data in perl using bash?

i have multiple perl scripts ,currently its working from the shell, but my requirement is like automate this scripts from the bash. perl smtp-check.pl < unmatched-00250 > good_smtp_251 2> ...
0
votes
0answers
21 views

How to 'correctly' make this file reorganization python script prompt for user input, check for validity, and then double check?

I have a modified version of this really cool script that was written the better half of a decade ago to reorganize really large folders full of random files into their respective directories. My ...
1
vote
0answers
30 views

Magic Enter in BASH like ZSH

How can I set magic enter in bash like zsh in oh-my-zsh? I have tried: bind '"\C-m":"ls\n"' But this makes bash unusable
0
votes
0answers
28 views

error in bashrc. 'syntax error: unexpected end of file'

When I try to run bash, it gives a syntax error: bash: /home/leo.bashrc: line 136: syntax error: unexpected end of line where the line number is the length of the document. The contents of bashrc are:...
1
vote
1answer
52 views

Bash script not working in Ubuntu in Windows 10

Is Ubuntu different from Linux on a Mac? Sorry if this is a basic question...I am new to this. I am trying to run a bash script that creates a .sh script out of some FASTQ files. This works in the ...
0
votes
2answers
65 views

Bash from scratch

I know this may sound ridiculous, but in my defence I'll say I'm at the very beginning of messing around with coding and bash in particular, so don't judge me too harshly... I just dipped into this: #!...
0
votes
1answer
40 views

Automatically enter user input several times to command stdin

I need to perform a conversion of digital certificates from pfx to pem on an external application from which I can run system commands. I can do this from CLI by using the command: openssl pkcs12 -in ...
0
votes
0answers
18 views

SSH terminal window hangs when command output is wide and long

I am using Tilix on Ubuntu, updated and upgrade. I am accessing a Debian machine, updated and upgraded. Everything works fine, except when I fire a command which has lot of output, usually ...
0
votes
0answers
15 views

ddrescue on windows right command for the disks

i'm trying to recover from bad hard drive with ddrescue on windows so in ubuntu i did this command to run sudo ddrescue -d -r 1 /dev/sda '/media/ubuntu/New Volume/recoverdrive.img' '/media/ubuntu/New ...
0
votes
0answers
15 views

Run a sh with Xvfb display using cron?

I am trying to run a sh script using cron. This script requires a display. I have tried: # Xvfb display /usr/bin/Xvfb :10 -ac -screen 0 1024x768x24 & 15 17 * * * /bin/sh /path/to/script/script.sh ...
-1
votes
3answers
90 views

How to rename files in ubuntu, recursively, using grep and rename not find?

There are gazillions of questions and answers regarding how to rename files. I'm new to Linux and this myriad of possible ways and different results and different configurations confuses me. For ...
0
votes
0answers
32 views

How do I edit this bash script, to only look for english subtitles

I have found and edited a bit in this script: #!/bin/bash # # Version 1 # # (C) 2016 Daniel Faust <hessijames@gmail.com> # # A BASH script that extracts subtitles from a matroska file. # # ...
0
votes
1answer
63 views

How to launch default browser from bash script

How do I launch the default Web browser from within a script? In the below script, the browser opens when the script is successfully run as an executable shell script: #!/bin/bash cd $1 php -S 127.0.0....
0
votes
1answer
28 views

bash, display only in case output has count of n characters

how can I display content of output which has only count of n characters in second col divided by ,? For example, grep only line which content 4 characters in second col. Input. a,123 b,223 c,1234 d,...
-2
votes
1answer
31 views

How to write a shell script for printing the PID and The owner and the Name of the Process using the Special Variable $$ as parameter for the skript

The script shall present the command pstree -hsup $$. I have tried many different ways but I couldn't find a way to print the output like this 28348 (bash,root) 28347 (su,root) 28346 (sudo,root) 14085 ...
0
votes
0answers
9 views

how do I fix these error ? $'\r': command not found in WSL [duplicate]

./jvm/build.sh: line 2: $'\r': command not found Running JVM build script ./jvm/build.sh: line 4: $'\r': command not found : invalid optionline 5: set: - set: usage: set [-abefhkmnptuvxBCHP] [-o ...
0
votes
3answers
57 views

merging tab delimited txt files based on column (which is header ) in bash?

Im having two text files which contains million records , all the records are tab delimited , how we can merge these two files based on same header(column)? file:1 LogEntryTime nameId ...
1
vote
1answer
41 views

How can I log in and run a bash file at boot?

I got myself a minecraft server that turns on and off on specific hours but I don't want to type the commands every time it should start playing and let it run those commands after boot. I found an ...
0
votes
0answers
22 views

MAAS set default cloud-init script

I have a MAAS server that deploys Ubuntu workstations. When I deploy, I paste in a bash script I made: Is there a way to set this bash script as default? So that MAAS would always use this cloud-init ...
0
votes
1answer
44 views

Shell script errors out due to PATH variable not set

Ubuntu version: Ubuntu 20.04.2.0 LTS Shell: bash I have a shell script which will be executed by root from root’s cron job. But, even when I execute the script manually, it errors out saying the ...
0
votes
0answers
21 views

Output of `top` command not saved to variable

I created the follow bash script, called ./notify-me.sh, in Ubuntu: #!/bin/bash emailmessage=$(top -b -o %CPU) echo $emailmessage But when I run this script by doing ./notify-me.sh and pressing the ...
0
votes
1answer
42 views

Bash script output on the screen also to the log file

I created a simple script that does a curl command ( I run it every month via crontab ) and I made it echo to a logfile with the date of run. The problem is that I want to receive the shell script ...
2
votes
1answer
21 views

How to delete a tracker tag containing special characters

'tracker' is a command-line file indexing and searching tool. Among other things, it allows files to be annotated with tags. I'm trying to delete a tag from a PDF file. Other tags on other files have ...
0
votes
0answers
11 views

Print Notification to Text File if Website Back to UP using CURL or Bash

I'am sorry, i new in programming. I will a simple script. Current Condition, i already create script if status website 200 or 301, Website is UP. If status not 200/301 , website down. Now i success ...
1
vote
1answer
32 views

Brace expansion doesn't work the way I expect

I wonder why doesn't my command work the way I expect? Here is my command: touch resources/views/front/user/{index, show, create, edit}.blade.php What I expect is to create 4 files in that path but ...
1
vote
1answer
40 views

bash tab auto-complete is too slow but it isn't with teraterm or putty

I'm using Ubuntu 18.04 and it got stuck in 1~2 seconds when I push the tab button for auto-completion. I've been trying to resolve this problem but I couldn't make it. I even changed my computer to ...
1
vote
1answer
44 views

Bash script for copying files to subdirectories named after the file´s owner

I need to write a bash script which copies files from a folder to subfolders named after the files. For example, there is a common directory "For all", inside there are various files and ...
0
votes
0answers
27 views

Capture a string from JSON response

I have below Json response for POST method in bash and would like to capture value after sessionId":" and assign it to variable session_ID. {"changeId":"79911476-53a4-46e1-...
0
votes
1answer
38 views

Why we use ./ instead of just typing its name when running the script? [duplicate]

when we run a normal command we just type the name of it but why we use ./ instead of just typing its name when running the script?
1
vote
0answers
22 views

How to pass .json file in a .sh script so that the Jenkins build will install/include it

When running some integration tests on Jenkins, I get this: "[Failed to read configuration file. Failed to open JSON file '/etc/ara_tsyn.json'.]" Locally, I don't get this error cause i have ...
0
votes
1answer
28 views

Using awk to append text to the end of a line in /etc/group

I am writing a script to automate some tasks and I need to add a user to a group in /etc/group. I'm trying to use this command: sudo bash -c "awk '{if (/^moli/) {$0=$0"$uservar,"}; ...
4
votes
0answers
44 views

Preserve colors in console of a Bash script output while logging

I would like to preserve colors, in console, of a Bash script output, while logging and echo it to console. When I run a script with the following code, I lose colors in console. LOG_FILE="Merge....
0
votes
0answers
31 views

Why use tee with wget? Isn't it superfluous?

So I came across this code for downloading youtube-dl using wget which pipes into tee here: How can I update youtube-dl? The code being: wget -O - https://yt-dl.org/downloads/latest/youtube-dl | sudo ...
3
votes
2answers
367 views

how to use command line argument to find .txt file that have common name

I have multiple files in a directory called files. I have to read each .txt file from this directory: abc123.txt abc234.txt abc345.txt abc.txt def123.txt def234.txt def345.txt For example, when I ...
1
vote
1answer
75 views

How do I get a bash script file to request a prompt before continuing to the next step?

I have a one line script to create a file in a directory and open the file with Kwrite. I'd like the script to prompt for the file name to be created and to be opened by Kwrite. At present it doesn't ...
0
votes
0answers
25 views

command and shell scripts

I try to apply many progresses on one file then to show the result step by step: #!/bin/bash sp=835 cat sp835.su | suacor | suximage perc=95 ; cat sp835.su | supef maxlag=0.85 | suxwib clip= 1 ; cat ...
-2
votes
0answers
43 views

Bash script to download files from sftp by filtering today date

I'm looking to automate some jobs via bash script. The script should listen all the times, as it start process once a new file with matching today's date, then the script end of its own. In ...
0
votes
0answers
45 views

path with No such file or directory

when i run shell file i got the below error unable to execute u'/usr/local/cuda-11.1/bin/bin/nvcc': No such file or directory error: command u'/usr/local/cuda-11.1/bin/bin/nvcc' failed with exit ...
6
votes
3answers
135 views

Configuring systemd to manage a service on boot

I have a script that downloads an image from a web page and sets it as my desktop wallpaper. The code works fine but I am having trouble getting it to run on boot. I am trying to do this by ...
0
votes
1answer
58 views

Allow a user to run a script as sudo with sudo commands in the script

So I created a script that live in /usr/local/bin called Linux-Permissions. In the script, there are some sudo cp commands. I need a user to be able to run the command as sudo, which I was able to do ...
0
votes
1answer
34 views

variable substitution

I found this on shell script, in variable substitution option using cap symbols can anyone explain the logic of this nf=${f:gs^__^/^} for f in notes__* books__*; do nf=${f:gs^__^/^} perl -p -...
0
votes
1answer
36 views

filename is distorted with '$/r' appended to filename [duplicate]

I am trying to learn linux commands so please bear with any ignorance. I am creating a file with cut command which is written in Script.sh file. But when the file is created it adds '$/r' to end of ...
0
votes
0answers
16 views

On bash terminal scrolling starts to go through history of commands rather than scroll up and down

Ubuntu 20.04 Sometimes I can scroll up and down on the bash terminal just fine but it sometimes happens that when I scroll, my terminal starts to roll over my command history. Can you help me ...
3
votes
3answers
112 views

Bash script to run FFmpeg concat on MP4 files in batches of 5

I like to create a Bash script to concatenate MP4 files using FFmpeg, in batches of 5 files at a time for a directory with 100 MP4 files, so that afterwards there would be 20 files like: 001_005.mp4, ...
0
votes
1answer
21 views

bash: ./mmwave_sdk_02_00_00_04-Linux-x86-Install.bin: cannot execute binary file: Exec format error

I am trying to execute this binary file. I did sudo chmod +x ./mmwave_sdk_02_00_00_04-Linux-x86-Install.bin and got the following error bash: ./mmwave_sdk_02_00_00_04-Linux-x86-Install.bin: cannot ...
1
vote
1answer
28 views

bash: ./qt-unified-linux-x64-4.1.1-online.run: cannot execute binary file: Exec format error

I am trying to execute this .run file. I did sudo chmod +x ./qt-unified-linux-x64-4.1.1-online.run ./qt-unified-linux-x64-4.1.1-online.run and got the following error bash: ./qt-unified-linux-x64-4.1....

1
2 3 4 5
196