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

learn more… | top users | synonyms

0
votes
0answers
10 views

logrotate files older than x hours

What's wrong with this rotate.conf? Goal is to delete only files older than four hours path/to/tokens/*.tkn { nosharedscripts prerotate if test `stat --format=%Y $1` -le $(( `date +%s`...
0
votes
0answers
13 views

bash: $'\302\211[COMMAND]': command not found

I've used bash in xterm on Debian Jessie for about 2 years. Just recently I sometimes get an error bash: $'\302\211[COMMAND]': command not found. The only help I can find on the topic is Piping grep ...
0
votes
1answer
9 views

bash function - use . character as parameter

I am trying to create a personalized function to wrap git add. Since I'm not a bit fan of having to type git add a/long/path/to/some/file/that/has/changed.java I am trying to create some sort of ...
0
votes
2answers
20 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
22 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 $...
0
votes
1answer
33 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 ...
-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 ...
2
votes
3answers
36 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 ...
2
votes
0answers
5 views

Restricted bash circumvention via SSH command execution

There seems to be a trivial rbash circumvention, whereby an SSH user can simply request that bash be executed. The environment consists of a restricted $PATH, with a tiny subset of commands available....
-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
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....
1
vote
0answers
35 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 ...
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 ...
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 ...
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
0answers
6 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
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><...
-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. ...
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
2answers
33 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 ...
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
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 ...
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 ...
-4
votes
1answer
32 views

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

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
3answers
56 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 ...
2
votes
2answers
99 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. ...
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/...
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....
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 ...
0
votes
0answers
15 views

Will Bash on Ubunutu on Windows be available for 32-bit Operating Systems?

Windows announced the the Anniversary Update of Windows 10 on August 2nd 2016 will include a feature called "Bash on Ubuntu on Windows". Users who receive insider builds have already had a chance to ...
-1
votes
1answer
36 views

can bash on windows10 execute windows programs?

I'm excited about the possibility of having a decent command-line interface on MS Windows using bash, I haven't installed windows10 yet though. In bash in windows would I be able to run windows ...
0
votes
0answers
19 views

Execute a command stored in a variable

I want to write script that will show cpu utilization for one service. below is script and output for the same. Kindly assist. Script : yourpid=$(service tomcat_SP status | cut -d':' -f2) #this will ...
0
votes
1answer
37 views

How to sort a text file with three columns, each separated by a comma?

I have a text file as such, 1151,1000,801; 1152,3000,801; 1154,1000,801; 1156,3000,170; I'd like to sort based on the third number in each row. How can I do this?
0
votes
1answer
31 views

Screen ctrl+a key not working for going to start of line

I recently started using screen: ctrl+a key not working for going to start of line How do I configure it? Is there a better alternative over screen?
1
vote
1answer
30 views

Allow one User to Log into other Users (Sudo)

I'd like to give a particular user the ability to log on as any normal user (e.g. not root or daemon) and execute commands as that user. How can I do that safely? Currently my User sudo rights on a ...
0
votes
1answer
26 views

How to write a Bash script that accepts options?

I'm writing a Bash script to make easier to start a local webserver that I use for testing purposes; I don't need it running all the time, it is more useful to me to start it when I need it. Right ...
-1
votes
3answers
44 views

How to extract a specific line in multiple text file into a single txt file on linux?

I have 5000 txt files with the different data below that. I need a shell script to copy only line 11 (last line) of them into a single file and sort them from smallest to largest. for example: file1....
0
votes
0answers
8 views

How to restore /usr/libexec/java_home on Mac OSX El Capitan?

In the process of attempting to restore a bad jdk installation, my /usr/libexec/java_home executable was removed. Is there any way to restore it?
0
votes
1answer
65 views

Getting 256 colors from Cygwin within cmder/ConEmu

I am trying to get 256 colors under Cygwin while running cmder. Generally, what I am doing is opening a terminal session in Windows 10 by typing "cmd" into Start. If I need to open a Cygwin terminal, ...
1
vote
1answer
49 views

I want to install GUI applications on Bash on Windows

I wanted to install some GUI applications on Bash on Windows but I got GTK_BACKEND doesn't match available displays. I searched for this error, but none of them actually solved it. I've tried pkexec ...
0
votes
0answers
23 views

Bash - Removing all but a single number in output of command

I'm working on a script to process all images in which the standard deviation is less than a certain threshold, e.g., if overall SD is less than 50 in x image, do y to x. The command I am using to ...
0
votes
1answer
24 views

syntax error near unexpected token `(' writing bash function

I have testapi() { docker-compose -f /home/me/projects/api/docker-compose.yml run -e "API_BRANCH=${1-master}" --rm api_test ;} It causes error: $ src bash: /home/me/.bash_profile: line 56: syntax ...
0
votes
2answers
14 views

bash to print log with user, date, and time

I am trying to print a log using bash that captures the some text, logged in user, date, and time and prints it to a file analysis. bash echo "analysis done by" "$USER" "on" && date +"%D" &...
2
votes
1answer
25 views

Bash: amount of bytes used in a log file grouped by token

Assume a large log file of several GBs and several million lines where each line contains a token identifying the user account that generated the line. All tokens have the same length and can be ...
0
votes
0answers
25 views

Docker exec doesn't load aliases

I have a bash alias loaded into a Docker container, in /etc/bash.bashrc. It functions as a shortcut to a commandline PHP script. This is convenient, since anyone can use that alias directly after one ...