Questions tagged [bash]

Bash is a free shell for Unix-like operating systems from the GNU Project.

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

Modify JSON via bash command line [on hold]

I have a hierarchical database I created in JSON format that I need to, in combination with a bash script, add, remove and edit content from. I already have gron which can print the JSON in an easily-...
0
votes
1answer
6 views

SSH ProxyCommand with AWS Session Manager - no shell started

I'm trying to setup proxy that connects via AWS Session Manager with ssh command (to be used by ansible). As of right now, I'm able to connect to my vm with AWS CLI command like so aws ssm start-...
5
votes
3answers
282 views

Manually select/unselect lines before forwarding to stdout

Is there any way to grep interactively, meaning that I have a bunch of lines coming from somewhere that I want to pipe to further processing, with the option to manually specify the lines I want? ...
1
vote
1answer
9 views

How to get the package name of a non-built-in command?

Background Description: I pull a docker image of fedora from hub.docker.com and run it. The image has been extremely slimmed for minimum size. The result is: the non-built-in command "find" is not ...
-1
votes
0answers
26 views

Rsync freezes/hanging/stopping after a couple of files of a 25,000+ file transfer on Ubuntu

The distro I am running this on is Ubuntu and I have this folder with 25,000 images (around 80MB total) and I want to transfer all of them to a server. This is the command I am using: bash rsync -...
2
votes
1answer
22 views

Reference in remote script not resolved

I'm trying to execute a script in the remote machine using ssh. I'm using the below command, ssh -i <remote pem> <user name>@<ip> "sh <full path of script in remote> <...
0
votes
1answer
37 views

I don't see my mounted DVD being listed when I use the ls command to list all that's on my Desktop

I don't know if I did something wrong, but I was able to see the mounted DVD label name in Terminal when I did the ls command earlier while in my Desktop directory, now I can't, even though the DVD is ...
0
votes
0answers
20 views

How to batch download still frames from youtube videos?

I am working on a project that requires running analyses on around 20k videos hosted on youtube.com. For my analyses, I need 3-5 screenshots of each video, at different points in the video. I know ...
2
votes
1answer
24 views

Is it possible to make a command-line alias for `!!`?

I have a somewhat idiosyncratic CLI workflow, but it works for me. I commonly iterate on commands and then use the result of those commands in the next command. For example: Finding a file: $ ff ...
0
votes
1answer
25 views

Jenkins Pipeline sh step hangs

I am currently having an issue with Jenkins running on Ubuntu 18.04. The sh pipeline step hangs and eventually times out with the following message: [Pipeline] sh process apparently never started in /...
0
votes
2answers
22 views

Why does Bash give “No such file or directory” for a program that's in my PATH?

I installed docker-compose on my Ubuntu 16.04 machine following the instructions at https://docs.docker.com/compose/install/ to use curl to download the binary directly to /usr/local/bin/: $ ls -lh /...
0
votes
0answers
14 views

How do I execute a Vim selection or range in bash without replacing it?

I have the same question in this post. How can I execute a Vim selection or range in bash without replacing it? But the accepted answer in this post, didn't work for me. The command isn't picking up ...
1
vote
1answer
57 views

How can I stop an inlined background process when my script stops?

In a shell script, I do the following: #!/bin/sh while true; do ssh -o ExitOnForwardFailure=yes -L 8080:localhost:80 -N server; sleep 1; done & ... rest of the script, which uses the tunnel as ...
0
votes
0answers
21 views

SYSTEMD Execute interactive shell scrip after reboot/init N/shutdown command is initiated

I need to know is it possibe to execute interactive shell sctipt whenever user(root also) initiate reboot/init/shutdown command. Till now I have created a custom service which looks like this [Unit] ...
0
votes
1answer
28 views

Use awk command to output of ls command

I have a e-book directory that has following format: <authorname> <authorsurname> - <bookname> I want to separate the books by authors. I use the below command in a for-loop for ...
0
votes
1answer
37 views

Is it possible to execute a while loop in the background?

I am creating a shell script and want to execute a certain while loop in the background. Normally, I would create a new watch.sh file containing: while true; do ...; done Then, in my main shell ...
-1
votes
1answer
38 views

Bash script to collect information from remote servers [on hold]

I am working on a script, In which I need need to ssh to a couple of remote servers and need to collect the load average of those servers. Note: Remote server don't need the username or password. eg: ...
-1
votes
0answers
34 views

Grep freezes after 9133 iterations

So, I'm working on a bash script that will take a logs file and check each line for keywords, Adding it to another file and checking against a duplicates file for duplicated lines, At the moment while ...
1
vote
0answers
17 views

Can I get the MSYS2 Bash as an optional shell on Windows OpenSSH server? (Not Windows 10)

Goal: Add MSYS2/MinGW64 BASH as an optional shell to an existing OpenSSH server with automation purposes in mind. Constraints: Not Windows 10. WSL is not an option. Shared work environment. Shouldn'...
0
votes
0answers
24 views

Defer the execution of some ~/.bash-files commands, to be non-blocking

I have my .bashrc and .bash_profile being loaded at shell start; except for some export and alias, there's a command that needs a couple of seconds to run: [ -s "$NVM_DIR/nvm.sh" ] && \. "$...
0
votes
0answers
23 views

Continuous RTSP stream recording with ffmpeg. Can I optimize it to not damage the SD card?

I have got an IP camera with RTSP stream. I decided to record the stream using ffmpeg (version 3.2.14-1~deb9u1) on the Odroid-N2 device with Armbian. I have created a .sh script which is launched by ...
0
votes
1answer
34 views

Bash: Cleaning a folder and its subfolders of .log file

How can i loop through a directory (and subdirectories) and delete every .log file? I want to use a bash script to clean my Minecraft server directory. In Windows (batch) i use this line to loop: for ...
0
votes
0answers
11 views

AdonisJS PATH setup OSX

I've downloaded adonisJS to my computer, for first time it gave me an access error, so I followed some intstructions and I made a new .npm-global folder to be able to download/store Adonis. It works ...
0
votes
1answer
13 views

Why piping into node not showing output when there is no console.log?

This is the Linux bash terminal: $ node > 'aBc'.toLowerCase() 'abc' > .exit $ echo "console.log('aBc'.toLowerCase()) " | node abc $ echo "'aBc'.toLowerCase()" | node You can see when I type ...
0
votes
0answers
18 views

Error in setting up Fuchsia

I was trying to build Fuchsia. During importing the source, it says to add /fuchsia/.jiri_root/bin to my PATH. I did it but the ERROR says, Updating all projects ERROR: 'git fetch -p origin' failed: ...
0
votes
1answer
25 views

SNMP pass script works but snmpget for OID doesn't provide correct result

I wrote a prototype script to start examining the status of a service using SNMP. The script itself, seems to work, as I am using mysql as a test example, but the OID as requested via snmpget returns ...
0
votes
0answers
20 views

How to have a single history from all bash terminals?

I typically have multiple bash terminals open and I would like for the commands from all terminal sessions to go into a single history file, so I can see my command history chronological order across ...
0
votes
1answer
23 views

I get different results with hd and hexdump, aren't they the same? [duplicate]

When I run each command, I get the following output: root@ubuntu:~# hd test.txt 00000000 31 32 33 34 35 36 0a |123456.| 00000007 root@ubuntu:~# hexdump test.txt ...
1
vote
0answers
33 views

What is the appropriate way to target a variety of operating systems and hardware in bash?

Currently I am doing essentially this: if [[ "$OSTYPE" == "linux-gnu" ]]; then echo "a" elif [[ "$OSTYPE" == "darwin"* ]]; then echo "b" elif [[ "$OSTYPE" == "cygwin" ]]; then echo "c" elif [[ "...
0
votes
0answers
23 views

“npm start” error while start react-dom script

I am getting error while using "npm start" command on my windows laptop. The error is - C:\Users\USHAIL\Desktop\Shoaib\React\my-app>npm start > my-app@0.1.0 start C:\Users\USHAIL\Desktop\...
0
votes
0answers
8 views

rvm not recognizing installed gem

I need ruby to run our automation suite, but I am unable to use the version required by the source. I have the version which I believe installed with xcode, 2.3.7, but this will not run the automation ...
0
votes
1answer
18 views

How do I get a command linked to one program run another program?

Kind of a weird situation here. I use a software package called OpenCV which installs a dependency called FFMpeg located at the following path. /root/miniconda3/bin/ffmpeg So, whenever I run the ...
0
votes
0answers
15 views

macOS hdiutil attach failed - No such file or directory

I'm trying to attach dmg file while executing shell script on VSTS Release Pipeline. Running hdiutil attach -debug dmgPath resulting in error: attach failed - No such file or directory. I'm sure that ...
0
votes
1answer
57 views

Access the root in Ubuntu bash on Windows 10

I'm trying to use a program called Packmol using an Ubuntu Bash on Windows 10, but for this program to work I need to move the "packmol" file into the "bin" folder in the Bash's root (I don't know why ...
1
vote
2answers
52 views

Debug HTTP status code of a big urls list

I have a list of urls and I need to debug it, eliminating those that are invalid or dead. For this I use the following script in bash (based on this post): #!/bin/bash list=$(pwd)/url-list.txt # ...
0
votes
1answer
41 views

copy all files with jpg/jpeg extension in specific sub categories to single directory

I have a directory structure as below product_images product1 LR low res images here HR high res images here product2 LR low res images here HR high res images here product3 LR low res ...
0
votes
1answer
19 views

Send AT commands via serial port using bash script on minimal linux

I need to init, with AT commands, a mobile modem without external libraries using only bash on minimal BusyBox. The mobile modem is on a serial port. It s working well with python but in case of ...
1
vote
1answer
43 views

list of on-demand shell variables?

tl;dr where can I find a list of shell variables that are on-demand (not listed by env) Variables like $OSTYPE or $COLUMNS (bash) or $RANDOM (bash) are not listed by env. Where can I find the list ...
0
votes
1answer
28 views

convert a bash array variable to a string delimited with `.`?

Not a duplicate of question. I am trying to make semvar pattern (1.0.0) from array having 1,0,0 as elements and create a git tag git tag $var. Error:- The above solution is just not working for . ...
0
votes
1answer
20 views

Customize Bash Prompt and apply the modification for all logged users

I have a linux with dynamic IP address. I would like to change the bash prompt according to the current IP. A python script is responsible for this connection and his launched at boot. os.system('...
0
votes
1answer
29 views

How to get WSL use Git-Bash to run a `latexmk` command?

Question: Can I call Git-Bash to issue a command from WSL? Detailed contexts go between the two dividers. I use an alias to compile all my *.tex documents, using Git-Bash on Windows 10. In my ~/....
0
votes
1answer
18 views

Why does plink or bash not recognize command on first line of remote commands file?

I am using plink and pageant in PowerShell to connect to and run commands on a linux machine via ssh. Within the PS script I am attempting to provide a unix script file to plink as follows. test.ps1: ...
0
votes
2answers
44 views

Does piping executes commands in parallel?

I'm trying to understand piping and redirection more in depth. In every guide it says that in cmd1 | cmd2 cmd1 will execute and stdout will be shared with stdin of cmd2. But that doesn't sit quite ...
0
votes
1answer
16 views

How to add a counter starting from a number other than 1?

I have a file where I need to add 200 more lines, but I'd like to know how to renumber them automatically. The file has the following structure: col1\tcol2\tdb4444\tcol4\tcol5\tcol6\tcol7\tcol8\tcol9\...
0
votes
0answers
7 views

Windows bash: open TortoiseGitProc.exe commit dialog with “All” checkbox checked

with this command i open the commit dialog of TortoiseGitProc.exe: TortoiseGitProc.EXE /command:commit /path:"C:\MyProject" /logmsg:"Fix foo" /notempfile /closeonend:4 i want also the "All" check ...
0
votes
0answers
34 views

No login to linux possible after root password recovery

I hope that I can find some ideas here on how to solve this specific problem that I have: I am supplied with a computer running on scientific linux 7. Unfortunately though, the root password is not ...
0
votes
1answer
31 views

PermissionError: [Errno 13] Permission denied gets thrown when starting the script in CGI, but not in bash

I have a python script on my HTTP server(CentOS 7) responsible for responding to the client browser, it works fine in bash, but when I try to access it via cgi, it just throws an error. It works fine ...
0
votes
2answers
28 views

How can I empty files at the same time with same paths?

I have a structure like this: Father: ├───Charlie │ └───lang.log ├───Ava │ └───lang.log ├───Sophia │ └───lang.log ... I would like to clean up the scheme. I try: cat /dev/null > Father/*...
0
votes
1answer
6 views

How to not return immediately to shell when VSCode is executed from shell

When I open a file in VSCode form Bash by typing code ${FilePath} it returns immediately i.e. I can start typing next command before closing the file. If I do the samething with other editors like ...
0
votes
0answers
8 views

execute a banged git-alias (!“tricky-functions here”) with a different shell

I have recently started using a system where /bin/sh --help reports an old version of bash. $ /bin/sh --help GNU bash, version 3.2.57(1)-release-(x86_64-apple-darwin18) This affects some of my my ...