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

learn more… | top users | synonyms

0
votes
0answers
24 views

Seeing actual commands typed in bash history

Is it possible to retrieve the actual commands typed in a bash history? If the command involved (for example) a history substitution or modifier, what is seen in the history is the resulting command ...
2
votes
3answers
33 views

Make program able to run from terminal command

Having program in /home/user/Downloads/program/main I can launch it by following command cd /home/user/Downloads/program && ./main or from GUI. What I want is to launch it from terminal by ...
0
votes
2answers
15 views

Tee a script to file within itself

I'm familiar with using tee, and I know that I can simply log output with script.sh | tee file.log However, I want a seamless interface for the user. Is there a way to, within script.sh, run tee ...
1
vote
1answer
18 views

Save output from terminal to file

I have this command which is being executed on a remote server. I tried to send it to a file on the server that is calling the ssh command but it doesn't look like it is working. ssh $SERVER "su $...
2
votes
4answers
1k views

Docker on Conemu

I am trying to make docker run on ConEmu by creating a task that open up Docker start.sh file usinggit bash. Since normally docker Terminal is pointing to "C:\Program Files\Git\bin\bash.exe" --login ...
0
votes
0answers
2 views

NeoVim FZF Hidden Files

Hello bash experts out there, I'm new to using neovim and I'm having a hard time figuring out why my FZF is not showing hidden files, such as .gitignore and `.htaccess`` Here's what I have currently ...
0
votes
1answer
18 views

Smart word wrapping in `less`?

I use the Python package rtv as a terminal client to read Reddit. When it gets to a large text box, it calls less display the text. Currently, less wraps the words according to column width, meaning ...
2
votes
4answers
240 views

Rename to Start Case or Initial Caps in Bash

I need a oneliner to rename all files in a directory from SomeThing.TXT NOT A FILE.ogg sensitive lalala.doc to Something.txt Not A File.ogg Sensitive Lalala.doc In other words: first letters of ...
0
votes
1answer
4k views

How can I use wget to send POST data?

I want to make following POST request to my server using wget: email=abc@abc.com&file1=@FILE_HERE&file2=@FILE_HERE In the above request, there are three POST parameters called email , file1 ...
20
votes
3answers
16k views

How do I get the output and exit value of a subshell when using “bash -e”?

Consider the following code outer-scope.sh #!/bin/bash set -e source inner-scope.sh echo $(inner) echo "I thought I would've died :(" inner-scope.sh #!/bin/bash function inner() { echo "winner"; ...
-1
votes
0answers
10 views

Enable scroll in conemu with Windows LXSS bash

screen in Bash from Windows Linux Subsystem used in ConEmu have no scrolling enabled. How can I enable it?
0
votes
0answers
16 views

Sort 'top' by CPU time accumulated since launch of top

OS X 10.11.6, GNU bash v3.2.57. How I want top to behave top in 'accumulative mode' (that's the name according to the man page, which I understand to mean: accumulated values are counted from launch ...
4
votes
1answer
9 views

How to map one array element which is separated by newlines into a new array with multiple elements

I select 4 files in Nemo in the path /home/myUsername/.local/share/nemo/scripts/Folder with spaces/. Nemo stores the file paths in the environment variable NEMO_SCRIPT_SELECTED_FILE_PATHS. (As you ...
0
votes
2answers
210 views

Concatenate header of one file with tail of another

I have a large gzipped mysqldump file which contains some table definitions and then many insert statements. I'd like to edit the table definitions but leave the insert statements alone. The file is ...
-1
votes
0answers
5 views

Web gui tool for control scripted tasks to end users [on hold]

Trying to find some web gui driven tool (linux installable) for such a tasks, for ex.: Office administrator clicks for active user check, then my bash script wrapper runs ldap tool for collecting ones ...
1
vote
0answers
34 views

Bash - log every input and output and write to file

I am often on assignment and sometimes I forget to document my work. E.g. write down output from different one off tools. Is there a way to automate that via .bashrc? So I open up a new shell, it ...
1
vote
2answers
34 views

grep a file and pipe the output to sed and store sed output in a file

Contents of source.txt: gold green white black blue yellow magenta brown tram kilo charlie tango Hi everyone! I need to solve a mystery. I'm trying to run a small script to grep a file source....
8
votes
1answer
537 views

Why doesn't this softlink work as expected?

bash4.3 # pwd /bin bash4.3 # ll sh lrwxrwxrwx. 1 root root 4 May 17 22:22 sh -> bash bash4.3 # ll bash -rwxr-xr-x. 1 root root 1072056 May 17 22:22 bash bash4.3 # bash bash4.3 # ...
0
votes
0answers
7 views

Connect to remote failed: couldn't open socket: connection refused (::comm::comm tcl)

I am using a piece of software with a lot of tcl support. I call everything as root. I attempted to put everything in the same directory. The relevant scripts are all executable. When I call this ...
0
votes
2answers
10k views

How to change from bash-3.2$ to [user@localhost ~]$ in UNIX

I am newbie to UNIX. When I was practicing some commands in UNIX. Earlier the Prompt was shown like this "[user@localhost ~]$". After some time it shows "bash-3.2$", but still some commands worked. I ...
0
votes
2answers
32 views

How to programmatically set the title text color in the OSX Terminal?

I have a script that runs in a tabbed terminal window which will periodically update the tab's title with some text using: printf '\e]1;Some Text\a' This works great, but I'd like to take to take ...
8
votes
6answers
13k views

How to echo commands in a bash shell script, but not execute them?

Is there a way for running a shell script with echoing the commands but w/o actually executing them? Let's say I have script removing a file whose name is stored in a variable: #!/bin/bash set -v FN=...
2
votes
2answers
1k views

How to get the machine IP address in a “systemd” service file

I need to get the IP of the machine and use it inside my service: [Unit] Description=Redmine server After=syslog.target After=network.target [Service] Type=simple User=redmine Group=redmine ip="$(/...
0
votes
3answers
11k views

Autostart programs/scripts in Debian 8 Jessie

I have a scipt (.sh) for screen rotation of my thinkpad on linux. I have now installed Debian 8 Jessie and the "Startup Applications" is no longer there, how can I make it to startup on boot? or user ...
3
votes
1answer
1k views

How to remove characters in the middle of a string in bash

In bash I have a string, and I'm trying to remove a character in the middle of the string. I know we can remove characters from the beginning or the end of a string like this: myVar='YES' myVar="${...
1
vote
3answers
6k views

Shell script bash: Moving file iterate based on month

I have very little knowledge about shell scripts, but unfortunately I have to write one. I want to ask about bash script iteration moving files, I need to move log files sorted by month which will be ...
1
vote
1answer
8 views

Removing and replacing the middle part of a string in bash

I've a few strings: Central and Western</td><td><a href="javascript:pop1('major-housing-estate/30006.html');" title="Kwun Lung Lau">Kwun Lung Lau Central and Western</td><...
0
votes
0answers
5 views

Add git access to /bin/bash (chroot) on Ubuntu, using Plesk

I have a couple users who wish to use git, they are allowed shell access but are chrooted into their own directory. I assume there has to be a way without exposing options to any shell at any level to ...
-1
votes
1answer
18 views

what happen on builtin command executed as background process

An external command was have new pid on executed as background process using & character, But The internal command was not done as separated process on normal execution because it done with shell. ...
0
votes
3answers
55 views

How to run a Bash script when using a graphical desktop login

I am running the MATE desktop on Arch Linux, and I have a bash script that I run which: Configures MATE to work with multiple monitors Connects the PC to the internet Changes my mouse speed I have ...
0
votes
0answers
18 views

Interruptable Loop that Does Not Interrupt Piped Processes

I'm trying to write a shell script which performs an operation every fifteen minutes until the user interrupts it, then aggregates all of the results to stdout and exits cleanly. My thought was to ...
1
vote
7answers
2k views
36
votes
7answers
46k views

When to use Bash and when to use Perl/Python/Ruby?

We are doing all our scripting with Bash so far, but I'm starting to feel a bit silly about it. While we can of course do everything we want with Bash (it's quite powerful), I'm starting to wonder if ...
0
votes
0answers
7 views

Displaying .svg files without saving them from the terminal

I'm looking for a way to dispay .svg files from the terminal without having to save them on my drive. Basically I want to pipe them into the program, and have the program display it (from RAM) and ...
0
votes
0answers
11 views

tclsh script within a sh script permissions

I am having an issue with calling a tclsh script from within a sh script on Ubuntu. I can call the tclsh script form the terminal successfully, yet as soon as I try and automate its calling from ...
0
votes
0answers
10 views

In fish shell, which command is equivalent to bash's compgen?

compgen is a useful command, and fish is an excellent command shell. But I cannot find an equivalent in fish. I write one by myself: function compgen --description 'Print a list of documented fish ...
1
vote
3answers
22 views

How to use test -h or test -L on OSX?

I'm trying to detect in a shell script if a file is a symlink pointing to a directory. This is what I'm doing: if [[ -L "$out_dir" && -d "$out_dir" ]] then echo "Dir is a symlink" else ...
9
votes
6answers
3k views

How to check if cygwin mintty/bash is run as administrator?

Problem Statement: What is the most elegant and robust way to test if Cygwin mintty bash session is "Run as adminstrator"? Why, specifically? I have typically several mintty terminals open when using ...
0
votes
2answers
4k views

Automatically close Terminal after script execution

How do I automatically close the Terminal after script execution? #!/bin/bash cd ~/Desktop/sh-scripts/ ./start.sh & // ??? how to close Terminal
1
vote
0answers
22 views

Using bash script to merge 2 ipset rules

I have 2 ipset rules in 2 files, they are: file 1: /etc/ipset.up.rules add mynetrulesssh 103.207.38.64/26 add mynetrulesssh 103.207.38.96 add mynetrulesssh 222.186.34.122 file 2: /etc/ipset.up....
13
votes
10answers
14k views

Is there a Bash command to convert \r\n to \n?

Is there a Bash command to convert \r\n to \n? When I upload my scripts from Windows to Linux, I need a utility like this to make things work.
-4
votes
1answer
32 views

How can tp, ps and kill be used by an administrator be used to deal with a “misbehaving” process? [on hold]

As part of a controlled assessment I need primary research. So if anyone who is knowledgeable in the subject please give an answer. I already know how much people dislike this but I need usable ...
0
votes
1answer
23 views

Compressor detection issue when running curl command from bash script in Docker container

I want to execute curl using bash script inside the Docker container. This is my script file script.sh that I added to the container: curl -X POST http://localhost:9200/tests/test -d usr/share/...
18
votes
8answers
50k views

Creating and formating a partition using a bash script

Is there any way to create and format a partition using a bash script? I think it can be done with fdisk but I don't know how to feed commands from the bash script into the fdisk shell then exit the ...
1
vote
2answers
363 views

Gem Installs not executing after update system-wide update Arch Linux

When trying to execute sass --watch scss:css inside of a target folder I get returned the message command not found I know I had sass installed. gem list doesn't show that it's installed anymore. I ...
2
votes
2answers
98 views

How to sort java's .property file containg <key> = <value> by <value> column?

How can I sort this property file from java project by its value column? The value contains tabs or spaces before or after the value. Here is how this file looks like, key1 = value1 key2 = ...
3
votes
3answers
42 views

How to grep multiple lines from a file in linux

I have a file with the below content. . . hello . . . world . . hello . . . . . world . . the dots indicates the other lines in the file. Here what I need to gerp only the lines hello and world. ...
3
votes
2answers
7k views

What is the ¬ key?

Struggling with UK keyboards, having recently moved here! Sorry for this oddball question, but the topic proved difficult to google about. To the left of key number 1, where I used to have backtick `...
11
votes
2answers
1k views

How can I prevent or interrupt accidental copy/paste in the terminal?

When I paste into the terminal, sometimes what is in the clipboard is not what I expected. Specifically, it is sometimes pages and pages of text from a website. When this happens, the terminal goes ...
0
votes
0answers
15 views

Bash one-liner to open several processes and execute a python function in each - poor man's parallel processing

I have a python file like my_functions.py and within that file is a function def func(a,b): result = does_some_stuff(a,b) return result Is there a way bash one-liner that would open N ...