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

learn more… | top users | synonyms

2
votes
1answer
24 views

Passing variables into ssh sessions (Session has to stay alive)

is it possible to start a ssh remote session and pass a variable to the remote host, which is usable in the opened session. For Example: Client: testvar="this is my text" Open ssh session (ssh user@...
0
votes
1answer
40 views

Shell script fails when executed by systemd service

So I have a systemd service called startup.service: [Unit] Description=startup scripts [Service] Type=oneshot ExecStart=/home/user/Documents/Tools/Scripts/startup.sh [Install] WantedBy=multi-user....
0
votes
1answer
33 views

Difficulty getting /etc/rc.d/init.d tomcat startup script working

I have the following startup script that on reboot does not bring up tomcat: #!/bin/bash # # description: Apache Tomcat init script # processname: tomcat # chkconfig: 234 20 80 # ### BEGIN INIT INFO #...
0
votes
1answer
69 views

create firefox profile in virtual terminal

As part of a system setup process, I'm trying to create a default firefox profile on the command line using firefox -CreateProfile default and then proceed to customize settings, etc. This works ...
0
votes
2answers
34 views

Bash - sort by not first character

I want to sort my file by first column but I have to start sort from 5 character. How can I do that? My file: "TTTTCTTACA" 1 1 "TTTTCTTACC" 1 "TTTTCTTACT" 1 ...
1
vote
1answer
23 views

Camel-casing a 'dashed' string

I'm fairly inexperienced with *nix scripting, and I have a need to take a string with lowercase words separated by dashes and convert that to a new string with the dashes removed, and the first letter ...
0
votes
2answers
48 views

Can I delete only the first matching line using sed?

I have a file testfile.txt containing pippo=x pluto=y 1234=z I'd like to delete only the first line matching /^[a-z]\+=/ (the first line in this example). I've tried with the following command but ...
0
votes
1answer
23 views

Use netcat to bridge thru firewall?

I have a machine behind a firewall. It's my machine, I have set up ssh, but it's completely firewalled. My solution has been to use a reverse shell set up on a cron basis to reconnect if it fails ...
0
votes
2answers
38 views

cygwin bash - if statement doesn't work

I'm new to bash scripting, and I'm trying to learn on Windows, so I downloaded cygwin. Using Windows 10, cygwin v2.5.1 I made sure I installed the bash package (I did), and so I started going through ...
0
votes
2answers
42 views

tmux does not trigger when placed in rc.local

I want to start a tmux on boot on a raspberry pi - 2. I have written a session.sh file and I have places it in ~/bin/ file which is in the home directory. This ~/bin/ is also included in the $PATH and ...
1
vote
1answer
10 views

Fortran Compiler Installation Instructions for OS X

I try install fortran compiler for Mac OSX El captain. Firstly; I install install_f2c_osx.csh Run installation script $ chmod +x install_f2c_osx.csh $ sudo ./install_f2c_osx.csh It gives this ...
2
votes
1answer
28 views

How to delete a file from a command in a shell file for /etc/init.d?

I have a about question working with /etc/init.d shell script. All I want to do is delete a file from a command inside the shell script like so: case $1 in stop) echo "Stopping" rm -f /var/run/...
-1
votes
1answer
34 views

high priority for I/O operations

I came across this: http://linux.die.net/man/1/ionice however, it seems that it is not working on os x, as i got message that command not found. is there any alternative to it or way to install ...
1
vote
1answer
73 views

Bash Scripting and quotation

I'm reading a couple of books on bash scripting, and struggling to understand proper quotation and the use of IFS. Perhaps someone can help me with a small example involving filenames with quotes. ...
-1
votes
1answer
19 views

Spotlight now treating bash scripts as 'Document' instead of 'unix executable'

I have a directory of bash scripts I use frequently, and I tend to launch these via Alfred Alfred in turn relies on Spotlight to index scripts, and assign them a meta content type of 'public.unix-...
1
vote
0answers
22 views

Find windows program pid with its path

I want to kill a program with a windows bash script.I need to find the pid of a program with its path.we have three different directories with same program on a computer.We start all program all of ...
0
votes
0answers
8 views

Reverse search in PowerShell ISE wanted

In Bash, you can reverse search your history using Ctrl-R and start typing. Is there a similar feature in Windows PowerShell ISE?
0
votes
2answers
66 views

Importing variables in one shell script from another without executing the referred shell script

I have 2 shell scripts, file1.sh and file2.sh file1.sh #!/usr/bin/env bash export var1="/data/share" export var2='password' echo "Hello" file2.sh #!/usr/bin/env bash source file1.sh echo $var1 ...
0
votes
1answer
19 views

Check MD5 of a file header hosted on a webserver

I am writing a bash script to periodically download a setup file using cURL. The problem is the following, the file is around 110 MB and always have the same filename. I can download the file, check ...
0
votes
1answer
16 views

nohup on bash redhat is one processID different

I'm using capistrano to deploy a python service. I was trying to both start the service and also write a pidfile, so I can restart the service or stop the service later. The problem is the pidfile is ...
0
votes
2answers
14 views

How to terminate a cli app when stdout contains a certain string?

I've got a command line app that outputs lots of information to stdout. How can I terminate the program when stdout contains a certain string? e.g. something like: my_program | ...
1
vote
1answer
29 views

Check if a script completed executing instead of exiting

I'm working with a script that I cannot modify, that does not use exit codes. (all exits are simply 'exit') Without modifying the script (or yelling at the idiots who wrote it), is there a way to ...
2
votes
1answer
55 views

Disable autocomplete hints on iTerm2

I would like to disable the autocomplete history things that come up on the iTerm, as shown in the picture below: I would like to get rid of the blue hint that comes up when I start typing a ...
1
vote
0answers
59 views

Speedup zsh startup time

I'm on MacOS 10.11. When I open a new tab on Iterm2, it takes almost 2 second to have the prompt. So I guess I have something in .zshrc / .bash_profile / .bashrc that takes times to load. Here are ...
1
vote
0answers
14 views

Bash&TMUX - Continue after error

I want to write a bash script which opens new window in certain tmux session, runs another script in it and then closes. The problem is, if I launch two instances of the script, I want the script to ...
0
votes
1answer
53 views

How to extract specific data from the table?

Here is the table... Group Name Designation 2 (John) Front End Developer 12 (Jim) Back End Developer 8 (Jill) Full Stack Developer 21 (...
0
votes
1answer
14 views

Create a select list of users in Bash on OS X

I am trying to create a copy script to quickly copy a user folder in OS X, while excluding all the junk (caches, old iPhone Backups, logs, etc.). As far as not copying those files/folders I am not ...
1
vote
2answers
27 views

What is the equivalent of Linux's (bashe's actually) “&>” in Windows?

How can I redirect (to one file) stdin and stderr of the program? I look for something like &> in bash for Windows.
0
votes
1answer
16 views

Reset Cache using bash

I'm trying to automate a .sh file to run every time before Chrome opens, here's what I want to do. rm -rf /home/pi/.config/chromium tar -cvf reseterfiles.tgz /home/pi/.config/ The zipped ...
1
vote
1answer
22 views

How to 'set -x' for scripts other than my own

I am still dealing with a bug from another question which has gone unanswered because I can't get debugging information. I have scripts running other scripts and I need to see how the tty is getting ...
0
votes
1answer
73 views

how to mount chroot /proc on ubuntu start

In order to run java inside chroot environment I have to mount /proc file system using the following command mount -t proc none /proc inside the chroot environment or mount -o bind /proc /path/to/...
1
vote
1answer
77 views

Windows 10 linux bash shell ctrl+space doesn't set mark in Emacs

In Windows 10 I installed Subsystem for Linux Bash. But I have a problem with shortcut in Emacs Ctrl+space doesn't set mark point. What i tried and didn't help: I tried to uncheck "enable Ctrl key ...
1
vote
0answers
10 views

How to use custom configuration file in combination with autostart script in Openbox?

I'm trying to use Openbox with an autostart script as well as a separate copy of "rc.xml" (this is to be able to have multiple configurations on the same computer, but that's not relevant). Let's say ...
-1
votes
1answer
14 views

Apply the “expand” command to a file in-place like sed -i

The expand command does not have the equivalent of sed -i <file> expand actually does have a -i option - but it means only after blanks Is there a sed - expand dynamic duo combination ...
0
votes
1answer
21 views

Highlight selected words in Linux Command Usage Doc

What I want to do is print a command-help (viz. "ls --help") and grep the output for any specific word. Consider the following: ls --help | grep 'F' But what this does is just filter out the other ...
-2
votes
1answer
23 views

Syntax error whenever I execute this code

Whenever I execute this code I get the error syntax error near else. Here is the code: if [ -z $loc ] then      if [uname -a| grep 64 >/dev/null] then         sdir=$KALDI_ROOT/tools/srilm/bin/...
2
votes
1answer
82 views

Debian : -bash: ls: command not found

I have a vm to play with linux and wanted to try rbash. I followed a tutorial to make it work. Then I wanted to remove the stuff i've done, and delete a symlink from /bin/ls to /etc/skel/. But instead ...
2
votes
1answer
76 views

How to display IP at login screen in Arch Linux

I was able to do in Ubuntu by editing the file: /etc/rc.local and add: IP=$(/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}') echo "IP: $IP" > /etc/issue In Arch, ...
1
vote
1answer
43 views

Linux Shell script to change grep for a string, then comment out 2 lines above and 1 below the string found in the file

Looking for some help on this task. I have tried several shell scripts to do this, but not sure I am approaching this problem right. I have a file that contains several blocks of data like this: ...
2
votes
1answer
143 views

/dev/tty: no such device or address - only in a script

I'm pulling my hair out over this. I've looked over all of the google results for /dev/tty : no such device or address, none of them apply to what I am doing / none of the solutions are successful. I ...
-1
votes
1answer
34 views

How can I write this sed script?

Reads input number "n" and writes 0 1 ... n to the output by "n" times, separate by spaces. For example: n=3 1 2 3 1 2 3 1 2 3 Thank you very much!
-2
votes
1answer
16 views

Removing a substring between track number and title

I need help with a little bit of bash trickery. In organizing my music collection I've come across a set of tracks which are named in the format %track%. %artist% - %title%.%extension% How can I ...
1
vote
1answer
90 views

How to kill all child processes of a terminal, not a tty session?

At my workplace, we have a high-performance computing-cluster managed by SLURM. Some people's jobs spawn lots of processes with, as a federation, are one job. They also write the top-level controller ...
-1
votes
2answers
99 views

How to batch rename files by removing special character without using rename in linux shell

For example, I have 100 files and their names all have blank space. One of them is "The Monkey King Return (2015).mkv". How to remove all blank in name and replace with dot character, also remove "("...
0
votes
2answers
15 views

Find highest numbered files in directory

Scenario: A backup system creates rar archives and splits them in 100 MB parts. I would like to find the highest numbered files within this directory. For example in- and output: Input: ...
0
votes
0answers
17 views

Git installs to a network drive

I'm using Git at work (on Windows 8), but we have a variable in AD called 'HomeDrive', which is annoyingly set to a network drive. Git has decided to install the git bash and other utilities here, ...
1
vote
3answers
39 views

Display file contents if it has corresponding line number

I have two files in the following format: File A 4 5 8 9 File B 1 text 2 text1 3 text2 4 text3 5 text4 6 text5 7 text6 8 text7 9 text8 What I want to have for my output is just the following (the ...
3
votes
1answer
43 views

Gateway / Router Detection with Bash: Functions and Variables

I'm drafting / still brainstorming / a bash shell script. The aim of which, is to; help the user to: Interface with various CLI tools. Perform various administrative tasks. It might, ...
0
votes
2answers
54 views

bash regex for a file name

I'm really not that good with regex but I thought I'd be able to pull this off since it's not that difficult. I'm using find to see if any file that matches the regex exists in that dir. The string ...
0
votes
1answer
69 views

SSH executes the command differently

After several experiments I got to a surprising behavior by SSH. I usually access to a specific application through an SSH connection. In fact, that app is on a virtual-box on a workstation in a LAB. ...