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

Is there a way to get Notepad++ to spellcheck a heredoc?

I love the spellchecking I have with Notepad++ DSpellCheck, but it doesn't spellcheck bash heredocs. Is there a way to change this behaviour?
  • 572
4 votes
1 answer
123 views

sending print string command to remote machine

I'd like to print some string to all open terminals processes that are running in remote machine. currently I'm using ssh to connect the remote machine, and than I echo my string into wall command : ...
  • 143
1 vote
0 answers
14 views

wget and curl switch default to background task

When I use wget and curl from bash, it automatically switches to a background task by default, without me having provided the required arguments. This is making it hard to use these commands in ...
0 votes
1 answer
15 views

How can I create a symbolic link of a file in another directory with relative path?

THE PROBLEM I'm developping an ai training app. The app uses docker and some folders are shared (mounted). Absolute paths inside and outside docker differ, and I need to create symlinks that work on ...
0 votes
0 answers
15 views

Ubuntu 22 - zsh: command not found: lessc

OS: Ubuntu 22.04.1 LTS zsh 5.8.1 (x86_64-ubuntu-linux-gnu) Before installing oh-my-zsh everything worked, now I have issues. One of the issues is zsh: command not found: lessc, but who knows how many ...
0 votes
0 answers
21 views

How to pipe a user input after a command

I'm trying to automatize the call of the library ADB to connect to android. The command pair ask to user for a code, so I was thinking if there is a way to do all in the same call. C:\Android\sdk\...
0 votes
1 answer
22 views

What is the difference between “base64 -b0” in macOS versions prior to macOS 13 (Ventura) and “base64 -i” in macOS 13 (Ventura)?

Up until I recently upgraded to macOS 13 (Ventura) I could run this Bash command to convert a JPEG image into a Base64 string in a script I occasionally use: IMAGE_BASE64=$(base64 -b0 /path/to/image....
0 votes
1 answer
21 views

how can I convert svg xml code to image, using bash script in linux

I have a xml file which is xml code of captcha image. how can I convert it to regular image in bash script. <svg xmlns="http://www.w3.org/2000/svg\" width="150\" height="...
  • 3
0 votes
0 answers
22 views

Globally store all command line / bash / windows terminal input and output into text log files

I am looking for a global and automated way to always log all the input and output of all of the command line windows I am using into text files. I am using 3 types of console on Win 10 - git-bash.exe,...
  • 143
0 votes
0 answers
18 views

Bypassing bastion idle timeout : Session stopped

I'm forced to work through bastion to connect to the servers I work on. that's fine but the idle timeout is ridiculously small and it totally ignores the ssh keep alive of the client. I can't change ...
  • 11
0 votes
0 answers
10 views

Template Framework that Allows you to Inline Shell Scripts [closed]

I have been looking for a template framework tool for quite awhile that allows you to inline bash scripts (or possibly PowerShell scripts). I realize there are many ways to do this using popular pre-...
0 votes
0 answers
12 views

What is saving environment variables across logins? Using GDM to log in to a Gnome Wayland session (ver 43.1) on Debian Testing (19 Nov 2022)

I am on Debian Testing using GDM to log in to a Gnome Wayland session. I observe that the gdm-wayland-session process runs a shell script called /usr/bin/gnome-session, passing it "-l", ...
0 votes
0 answers
18 views

userinput File Type and Path validator - linux bash script [closed]

I need the user to insert the correct file path. The file type must be .txt The file path must be checked to ensure that the file exists. If the answer is not correct, repeat the question until the ...
0 votes
1 answer
23 views

Get output logs of previous command in ZSH

I'm working on a helper script that needs to run after every command to analyze its exit status and output logs. I understand that stdout/stderr buffers are not stored on pseudo terminals. I therefore ...
0 votes
2 answers
47 views

Remove the lines before and after the exact match - linux

I have a file like this in /etc/test/host.conf : # this is a test host = example.com private = 192.168.1.1 # end of test # this is a test host = example.com private = 192.168.1.2 # end of test I ...
0 votes
0 answers
16 views

discard buffered output when displaying binary file by mistake

It happens that I send by mistake the content of binary files to the terminal. Eg: I run a cat file or curl http://some.url/ when I was expecting the result to be plain text. In such cases I need to ...
  • 343
1 vote
0 answers
35 views

Is there a way to print a commands stdout/stderr only after a given 'timeout'?

Imagine a command which usually takes less than a second to complete an in this case you don't want to get bothered with verbose output, but sometimes it takes longer and in that case you want to have ...
  • 997
0 votes
2 answers
43 views

Setting environment variables in bash script doesn't work?

If I run this on the command line, it will make the commit be at the specified date: THE_TIME='2022-01-01T22:50:12 -0700' GIT_AUTHOR_DATE=$THE_TIME GIT_COMMITTER_DATE=$THE_TIME git commit -am 'commit' ...
0 votes
1 answer
14 views

Git Log of a particular file from a particular commit only

git log --graph --decorate --pretty=oneline --abbrev-commit --patch --full-history --follow -- "${FileP}" prints * b8800d8 (HEAD -> master, origin/master, origin/HEAD) chore(export): ...
  • 353
1 vote
1 answer
21 views

Separate file path from command in Bash under WSL2

Is there a way to separate the file path from the commandline in the Bash prompt in WSL2? For example: Current: user1@DESKTOP-RMF1234:~/mywork/helloworld/tests$ ls Expect: user1@DESKTOP-RMF1234:~/...
  • 127
-1 votes
0 answers
25 views

How to command a 4 word search?

Using Kubuntu 22.04.1 : neofetch # OS: Kubuntu 22.04.1 LTS x86_64 grep --version # grep (GNU grep) 3.7 What is the Terminal command to do a 4 word search? Objective search 1000s of files ...
  • 117
1 vote
1 answer
49 views

Is there a way to extract subtitles from an MKV while maintaining the original format?

I am trying to extract (first, in case of many) subtitle track from mkv files (via CLI only, no GUIs) using ffmpeg or mkvextract. But there is one downside to this: I have to write the output name ...
0 votes
0 answers
21 views

Execute a bash script with a shortcut on Ubuntu

I've a problem, I'm trying to execute a script whith shortcut on Ubuntu but it doesn't work: enter image description here enter image description here Can you help me please ?
  • 1
0 votes
0 answers
33 views

How to copy file of env variable to another file

I am executing bash commands inside a yaml file. I have set an env variable SECRET which point to a yaml file in my home directory, and I want to copy the content of this yaml file to another file, as ...
0 votes
0 answers
10 views

Redirect Error Messages for SFTP

I'm sftp to a server and I would like to download the files and all the info are redirected to a file. I have a bash script to do this, and it works great but when I get error messages, for example, ...
0 votes
1 answer
12 views

FFMPEG MultiPlex all video's to all audio's

(windows 10 64) I have seen & read MULTIPLE (50+) answers to forms of this question but not for what Im trying to do. I have a folder with 30+ short clips (few seconds each) mp4's I also have a ...
0 votes
1 answer
14 views

Starting ssh-agent from a script for use in multiple scripts (invoked by git)

I have some homepages in a git repository each. They are built by Jekyll. When I change something, I use git's pre-push hook to let Jekyll build the page and sync it with my HTTP server via rsync. ...
0 votes
1 answer
31 views

Bash alias based on conditional

I want to create a bash alias called pg to use a pager program based on a condition. The condition is: If most is present then use it, otherwise use less. This is what I have so far: alias pg='command ...
0 votes
0 answers
11 views

Find out the source of an installed CentOS Linux package, assuming chef and dnf install packages (system managed by chef)

The TL;DR here is if I have a command "checker" installed in a bash shell on a CentOS Linux server, is there anyway to easily find what package/source installed it to check what that package ...
-2 votes
0 answers
18 views

How to find and replace a line (in a file) which has / as a special character in it in shell script

How to find and replace a line(in a file)which has / as a special character in it in shell script? EX: If I have a.txt file cat a.txt has the following: abcfads <p name="myself">1889&...
  • 1
12 votes
2 answers
2k views

Why doesn't this unzip all my files in a given directory?

Why doesn't this unzip all the zip files in a given directory? find -name "*.zip" -exec unzip {} + \; Instead I get "caution: filename not matched:" for each matching item
  • 121
1 vote
2 answers
36 views

linux cp current directory level only

I have a dir that contains files and subdirs. I want to copy files in the dirs only, so I run cp -v src/* dst/ and get error cp: -r not specified; omitting directory. I'd be ok to ignore it but the ...
  • 842
0 votes
0 answers
2 views

Deploy Group Policy for Folder Redirects via Windows Script on Windows Server

GP via Script Is there a possible way to Deploy a group policy for folder redirects instantly working on the local active directory domain via a script? The script should create a new GP and set the ...
  • 1
0 votes
0 answers
20 views

I cant get the file to be read

I am trying to get the the read command to read from the file and put it in a directory. shellcheck says the program is fine, but I keep on getting a "bad file descriptor" message, and it is ...
0 votes
1 answer
20 views

How to ssh into a remote machine by passing through multiple bridges machines, become another user and run a command as that user

I need to save in a variable on my local machine a value that is returned from a script or command - let's take bash /tmp/script1.sh for the example - which lies on a remote machine - let's say ...
  • 166
0 votes
1 answer
30 views

How can I run a bash script everytime I open my terminal? [duplicate]

I want to run a bash script every time my terminal opens. I'm kind of new to Arch Linux, so I'm not an expert on it. How can I do this?
0 votes
1 answer
31 views

Why is my git bash (mingw64) running a nonsense command when using the -c option?

I am getting this at the moment when using git bash: C:\>bash -c pwd C:\Program Files\Git\bin\bash.exe: line 1: $'MZ\220\003': command not found /c When I use the debbuging option, I get this: C:\&...
  • 11
0 votes
0 answers
16 views

How can I perform bulk operations (move, copy, etc) on files in (my own) Google Drive?

I have a folder on Google drive with several thousand frames from two different animations mixed together. I have tried downloading the entire folder as a zip archive, but when I do that half of the ...
0 votes
0 answers
34 views

Fix powerline-shell bash prompt (mode: 'compatible' or mode: 'patched')

Background I have problems with powerline-shell prompts; for some reason I can't find any way to build the graphical > powerline character. I installed the python powerline json config with: $ ...
0 votes
0 answers
23 views

Reload user's group in a script

I'd like to create a new group in a script, assign the current user to it, reload the user's groups and continue executing commands that require the new group. In this related question I found nice ...
  • 171
0 votes
0 answers
8 views

include terminating newline in middle mouse button paste

Ubuntu 22's gnome-terminal lets you click-drag a selection including a terminating newline (say, a command to run). But when you paste it back into the shell by clicking the middle mouse button, the ...
1 vote
0 answers
25 views

Passing flags to a command inside an alias

I have created an alias for ls in order to let it print out a format that I like. I have defined the following alias to do this: alias ls="ls -lo --color=always | awk '{if (NR != 1) {print \$8,\$...
  • 11
0 votes
1 answer
24 views

Systemd service exits with "success" but does not perform the .sh script at ExecStart

I'm trying to use a systemd service on a Raspberry Pi (running Raspberry Pi OS version "Bullseye", a flavor of Debian) to run a bash script on login and it seems to succeed but the script ...
  • 181
0 votes
0 answers
22 views

windows exe on ubuntu server

I have to delete specific files on an ubuntu server. (If users have an problem with changing to home office and back) I use to run sudo find <start> -type f -name geometry.<bs>.<login&...
  • 103
2 votes
0 answers
51 views

How to source from stdout for both Linux and macOS?

On Linux I can do: source <(cat .env | grep ANDROID_GRADLE_TASK) But on macOS, this doesn't do anything (no error, and no source) What can I use for macOS? Is there a command that works both on ...
0 votes
1 answer
29 views

"echo $VAR | base64 -di > file" fail to execute on MacOS

On Linux I can do: echo ${ANDROID_KEYSTORE} | base64 -di > android/keystores/staging.keystore But on MacOS, the same commands gives: base64: option requires an argument -- i Usage: base64 [-hvDd] ...
0 votes
0 answers
22 views

Use newline as delimiter and pass as argument in bash

I'm trying to make a script that shows the differences between 4 similar repositories. This makes the most sense in bash, but I'm unable to delimit on newlines in just a way that I can use it as an ...
  • 101
0 votes
1 answer
109 views

Extract element from JSON array in file with jq

I have the following JSON file list.json : [ { "$type": "Profile", "ReferenceId": "6e374d9e-5bbe-4015-acd7-ae6f04de0db5", "Name": " ...
0 votes
0 answers
47 views

Bash printing a log file after a certain time

I have a log file with the following format: 03/22 08:52:52 TRACE :.......rsvp_flow_stateMachine: entering state RESVED 03/22 08:53:07 EVENT :..mailslot_sitter: process received signal SIGALRM 03/22 ...
0 votes
0 answers
23 views

rsync syntax error on round braces [duplicate]

I have this problem with rsync. If I run this command rsync -rltD --delete --update --itemize-changes /data/Program\ Files\ \(x86\)/ michele-backup@192.168.1.26:/backup-michele/Program\ Files\ \(x86\)/...

1
2 3 4 5
226