Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Questions tagged [bash]

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

0
votes
0answers
9 views

Bash on Ubuntu on Windows 10 not working in Safe Mode [on hold]

My PC has recently ran into a graphics driver error (AMD Radeon / Pathetic PoS) because of which I can only start it in Safe Mode. I used Bash on Ubuntu on Windows a lot but in Safe Mode it does not ...
0
votes
1answer
19 views

How to `export PATH` from C [on hold]

Wondering how to accomplish one of these things from C, so that it persists like it would from ~/.bashrc or ~/.bash_profile: export PATH=~/bin:$PATH export PS1="$ " Wondering if I should use the ...
0
votes
0answers
6 views

How to zip log in Centos 6.5 [on hold]

Now my server is storing log as files: server.log.2018-08-19-09, same form: server.log.yyyy-mm-dd-hh. I want zip log for day, sample server.log.2018-08-19.zip or .tar.gz .... to other folder and ...
-1
votes
0answers
52 views

auto pagination of terminal output

Octave has a feature to automatically paginate output that is longer than what fits on the screen: How can I achieve the same in a terminal? The accepted answer to a similar question suggests making ...
0
votes
0answers
27 views

How can I change values of the `.ini` files via command line? (linux or windows)

How can I change values of the .ini files via command line? (linux or windows) For example I have a php.ini file: display_errors = On error_reporting = E_ALL & ~E_NOTICE Now, I need be like ...
0
votes
0answers
22 views

Moving domain name from file using bash

Learning bash at the moment, and I know once I have performed wget cisco.com an index.html file appears. I know by doing cut index.html | cut "/" this provides me with just cisco.com. However, what if ...
2
votes
1answer
21 views

Does “git mode” exist for bash?

Honestly, I'm not really sure how to put it, but here goes. Does anything like "modes" (git mode, for instance) exist for bash? What I mean is: I'm using git through bash on Windows. I have ConEmu ...
0
votes
0answers
29 views

Get Filename and numbers from specific length string in bash script [closed]

I currently have the following in a Batch script: echo Looking for odt file with -00Ramkkar dir /b C:\users\%username%\OneDrive\Ramkkar\-00Ramkkar*.odt >Test.ITTemp setlocal EnableDelayedExpansion ...
7
votes
3answers
1k views

Can't pipe in bash's “mapfile” … but why?

I just want to get all the files in a certain directory into a bash array (assuming that none of the files have a newline in the name): So: myarr=() find . -maxdepth 1 -name "mysqldump*" | mapfile -...
1
vote
0answers
17 views

How to modify the behavior of the commands that delete “words” to the left

I've recently tried switching from being a long time tcsh user to bash and I was lamenting the extra key tapping for deleting "words" to the left, so I've been looking into modifying the behaviors in ...
0
votes
0answers
20 views

Unable to install anaconda distribution (permission denied)

I am trying to install Anaconda on the server machine: LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core- 4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0- amd64:...
-1
votes
0answers
10 views

ICMP echo replay limit with limited packet size

I am going to filter Ping request to my server, and only accepts 20 ping request with length 500 and max echo replay from my server 20. after 20 echo replay ping will be off. how can i do this by ...
1
vote
0answers
22 views

Detach a terminal from a process in D (uninterruptible sleep) state

I have a shell command in stuck in D state (imagine doing ls on a NFS share when the network is down). How do I detach from such a command? I can't kill the process in any way (well, it's called "...
0
votes
1answer
14 views

Bash script for Docker container in Windows returns “Unknown target”

I've downloaded a repository that contains a .sh script to open a Docker container. I'm running Windows 10 with Docker Toolbox (rather than the full version, which has some Hyper-V issues) and its ...
1
vote
1answer
32 views

Bash/Cygwin - aliases not behaving like command

I'm trying to get Cygwin setup the tools I use in Windows and am having some troubles. From this post, I found I could specify Notepad++ as my editor using alias notepad="/cygdrive/c/Program\ Files\ \...
0
votes
1answer
18 views

how to align lines to the left side with sed or perl one line liner

we have the following file how alignment lines to the left side with sed or perl one line liner more conf.env # Extra ssh options. Empty by default. export HADOOP_SSH_OPTS="-o ConnectTimeout=5 ...
2
votes
2answers
32 views

How can I hide the MacBook name and path name in terminal initial line?

When I run terminal I see my username and the path Marc-MacBook-Air:~ Marc$ Can I change it? Iso how can I change it into? Marc$
0
votes
2answers
48 views

Why does terminal output this every time I open it?

Every time I open Terminal, it outputs: -bash: e: command not found Is that normal? If not, how could I remove this? I'm using MacOs Mojave.
1
vote
1answer
11 views

How to disable the bash “bell” on ConsoleZ?

I am using ConsoleZ to work on multiple Cygwin bash terminals. I use the Teb extensively for path completion. But by default, the "bell" sound is heard whenever the completion is not unique. This ...
0
votes
1answer
31 views

Regular expression to match opening double quote missing a ending double quote

I have a large (25 million rows) data file that is pipe (|) delimited. The data vendor provides files and I run automated jobs to load the files to a Redshift database and then process the data. The ...
0
votes
1answer
65 views

Problems executing perl on git for windows bash

The issue is that perl is installed in my system and bash can see it, however when I try to execute a perl script that includes a module, there's an error. Can't locate Text/CSV.pm in @INC (you ...
0
votes
1answer
7 views

Curl argument in nvm insallation

The node version manager (nvm) package (https://github.com/creationix/nvm) uses the following command to install the package: curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/...
1
vote
2answers
21 views

how to rename all files under folder with specific extension name ( recursive approach )

we want to rename all files under /home/DB_home ( recursive ) so every file under DB_home will rename with .txt extension example before change /home/DB_home/hg/ir/qemu-ga /home/DB_home/td/...
3
votes
3answers
77 views

mv vs cp: what is different about the resulting file?

I had a bug where a configuration file for some application was not being included properly, so to try to isolate the problematic line of the file, I copied the old contents into a new file a few ...
0
votes
2answers
25 views

Linux Mint .profile TERM variable not set

I have a custom script in my .profile file, with added code and nothing taken away, however it is still replying with a TERM ENVIRONMENT VARIABLE NOT SET error. However, if I run the command echo $...
0
votes
1answer
4 views

How to use brew in crontab

I run an alias in my .zshrc file every day. alias buou="brew update && brew outdated && brew upgrade" I want to run it by crontab on my macOS v10.13.6 I made a file called ...
0
votes
1answer
61 views

How can I get the extension(s) of a file based on its content?

I'm planning on downloading a bunch of images from a website that don't come with an extension, so I want to add one based on the file's content or mime-type. file <filename> does a great job ...
0
votes
1answer
27 views

how to delete all files that are old then X days and ended with number/s

we want to delete all files that ended with number with digit or more as 2 digit or three digit and so on note - when files is ended with number , its tell us this file was rotate and actually backup ...
0
votes
0answers
20 views

Handbrake batch convert script assistance to set output extension specified by the official presets

With the help of numerous discussions on SE network and other places I finally managed to a working script that works well except the Matroska presets. I understand the problem is the script itself, ...
1
vote
1answer
20 views

Shell script: run screen, open several screens and run a command in each

Pretty much what the title says: My shell script should Run command A, wait until done run "screen" run command B1 in initial screen open new window (usually via Cmd-a-c) run command B2 in new ...
0
votes
0answers
16 views

Test if GUI has been run in linux bash

In my .profile file on my Linux Mint 19 terminal I need it to test if the GUI is running on any of the CTRL+Alt+F# keys, not just the current one. If it is not running it runs the startx command. If ...
0
votes
1answer
19 views

Color specific filenames (not extensions) in `ls` output like Makefile or CMakeLists.txt

I am currently working on a C++ project. I am using CMake as a build system and I would love to have all the CMake related files (like CMakeLists.txt) colored differently in the ls command output. ...
0
votes
0answers
11 views

How to improve PostgreSQL database backup script - used with crontab

There are about 15 databases to backup on a daily basis. Password is set for the postgres user. pg_dumpall is executed at the beginning of the script for a complete backup. pg_dump is ran in the same ...
-1
votes
1answer
33 views

Parsing a value from JSON blob with grep

I have a POSIX-compatible install script which determines the latest version of some software by grepping info from a json blob retrieved from a software registry: meta=$(wget -qO - https://registry....
0
votes
1answer
17 views

Multi-line bash prompt if path is longer than x characters?

I'd like to split my bash prompt into two lines if the path is "too long", so that the entered command always fits. My current prompt looks like: ~/go/src/asd$ ls -lah, so if the path is too long, ...
-1
votes
1answer
38 views

How to use “progress-bar.sh” to display the progress of operations that occur on remote servers

I need to integrate a progress bar to operations on remote server over SSH. In my situation there are several loops that trigger processes on few remote servers over SSH. These processes are being ...
0
votes
1answer
26 views

grep regex pattern matches on each line where only all matches appear and print on same line

trying to extract some patterns per line, from a log file. I am trying to extract the first time stamp, and two or three other matches but I want to be able to only print the matches from the lines ...
1
vote
0answers
31 views

simple pedestrian recognition from command line? [closed]

Maybe I'm not searching for the right keywords but I am looking for a really simple pedestrian recognition tool I can use from a command line - I only need to know, wether a human is in an image or ...
0
votes
1answer
76 views

* and -* in bash's case structure

docase1(){ case "$1" in -a ) echo "case a" ;; -b ) echo "case b" ;; ...
0
votes
1answer
60 views

Raspberry Pi headless, my if [[ file1 -nt file 2 ]] that thinks the two files have the same modified date

So I have a player script "player.sh" and an updater script "updater.sh". player.sh plays any mp3 file in /home/filepath/ using a wild card *.mp3, this works as expected. what I want is for the ...
1
vote
2answers
48 views

How do I make my backspace key functional in a bash script for Linux being accessed remotely from Windows?

I have a bash script on CentOS 7.4 with the following line that lets a user input a variable and then lets them confirm that what they entered is indeed correct: read -p "Enter the name of the ...
0
votes
1answer
32 views

How to use return value of a Bash command such as “ifconfig” to be used as an argument for an if statement in Bash script

I'm relatively new to Bash scripting but I'm very familiar with Python and many Bash commands. I was wondering if it's possible to use a command such as ifconfig eno1 and use the output as a condition ...
0
votes
2answers
28 views

Preview current directory in shell

What often happens when I work in a shell - zsh - is that I have cded somewhere and I want to have a quick look at the directory. Using ls may produce a lot of output and leaves it in the terminal. ...
0
votes
0answers
27 views

Sed doesn't works over variable

I'm trying to combine find -exec command with a function that should strip the relative path and copy to another place (with same tree). The script looks like the follows: function makeLinks(){ ...
1
vote
1answer
61 views

What does --) mean in bash's case struture?

I have seen a code snippet containing a case structure. while true; do case "$1" in --prepare) echo "prepare" ENV_PREPARE exit 0 ;; ...
0
votes
1answer
50 views

How to write -exec command with different format

Someone gave this script for log rotation. I want to know what is logic behind it. Though I understand all except --exec which was little confusing for me. original Script: #!/bin/bash set -x NOW=...
0
votes
0answers
134 views

How does one add shell parameters while executing commands with su?

The situation. I am debugging the environment of a restricted user who is relagated to a special shell. In order to do this, I need to run a command as that user in their full context using su like ...
0
votes
3answers
70 views

Why is the command history only saved on exit

I am trying to save a different history file per tab / terminal but I cannot manage to save it immediately after a command is run. The history is just saved when I run "exit". This is a problem as ...
1
vote
0answers
30 views

$RANDOM in $PS1 is not updated

I am currently trying to create a custom bash prompt, but $RANDOM is not behaving as i would expect, and I hope someone in here can explain why it is behaving as it does. I currently have a very ...
0
votes
2answers
19 views

cd in parent shell with python script

I want my python program to cd into a directory via terminal as a parent process. Is there any way to do this? I was hoping for something like this: $ ./cd.py Desktop/scripts $ pwd /home/mfto/...