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

learn more… | top users | synonyms

0
votes
3answers
18 views

Bash background process still blocking script flow in subshell

I am trying to do something that involves scripts calling other scripts in subshells to capture their output. One of the scripts needs to have a side effect of starting a background process. This all ...
6
votes
7answers
7k views

Linux/Bash, how to schedule commands in a FIFO queue?

I want the ability to schedule commands to be run in a FIFO queue. I DON'T want them to be run at a specified time in the future as would be the case with the "at" command. I want them to start ...
0
votes
0answers
5 views

Not getting any values passed through to RRD graphs

I'm getting a lot of NaN values being drawn on my RRDTool graphs and I can't understand why. My script to populate the RRAs in the RRD: #! /bin/bash LOAD=`cat /proc/loadavg | awk '{print $1}'` ...
7
votes
4answers
17k views

How can I get Mac OS X's proxy information in a Bash script?

I have several network locations set up on my laptop: Work, Home, etc. The work one(s) all have a proxy server set up, while the others don't. This works fine for OSX applications -- Safari, Mail, ...
5
votes
1answer
1k views

Local echo using Screen to connect to a serial terminal

Reading through the book "Building Wireless Sensor Networks" I learned that you can use the Screen utility to attach to a serial console. I tried using it to connect to an XBee module and it seemed ...
0
votes
1answer
13 views

executing history command as another user

I am confused as to why I'm having problems executing a history command as another user to return all that user's history - I need to loop though all users and get their history cat /etc/passwd | awk ...
0
votes
0answers
6 views

How to use scroll wheel for command output history in a minimal install

I apologize beforehand if this is either too general, or just in the wrong place but I have no better place to ask this. If someone ever booted up a GNOME desktop and accessed the terminal you would ...
1
vote
1answer
16 views

Launch consecutive commands in screen

I would like to launch cmd1 and cmd2 in the same screen instance. I want cmd2 to be launched only when cmd1 has completed. I have tried this: screen -d -m ./cmd1.bash "$File" && ...
8
votes
5answers
36k views

Unexpected end of file. Gzip compressed file

I am going crazy with a gzip file. I can decompress the file in Windows using WinRAR but it is impossible on any UNIX operating system. the file seems to be ok. If I do file the_name_of_the_file.gz ...
0
votes
1answer
105 views

SFTP key authentication not working from bash script

I am trying to set up a very simple bash script on Ubuntu that SFTPs to a specific server using public key authentication. When I run the command directly on the command line, it works like a charm: ...
0
votes
1answer
4k views

init.d script - Permission denied

I'm trying to create a init.d script for my server which should start/stop the teamspeak server and some node.js apps using "pm2". Here's my script: #! /bin/sh ### BEGIN INIT INFO # Provides: ...
0
votes
1answer
24 views

Curl command to download a file over HTTPS

I need to download a particular file from https://file_path. Here is the curl command I use for that: curl --user user:password "https://file_path?raw" > location I wish to download the real ...
1
vote
2answers
37 views

Ubuntu find files and directory matching a name in one line

There are parameters of find command for finding files and directories respectively -f and -d, but I want to avoid writing two find commands and && or || between them. I want to find file or ...
0
votes
1answer
17 views

Script not running on resume/wakeup in Ubuntu

I have a script named 999_thaw_flash.sh in my /etc/pm/sleep.d The script follows like this :- export DISPLAY=:0 #!/bin/bash case "{$1}" in resume|thaw) lynx --dump link1 >> file1 lynx ...
1
vote
0answers
16 views

How correct this local mail-sender script?

I have a task, write a shell-script, that: - All e-mails, that received by the user specified by the first parameter, sends to the currently running system users; - If sender is online, ...
17
votes
7answers
36k views

How to replace multiple spaces by one tab

I've some text files which contain some colums seperated by a various number of spaces, but instead I need one single tab as a seperator. Is it possible to do in Bash?
1
vote
1answer
26 views

Bash Script, Striping out newline characters in variable

Still getting the hang of bash scripting... I have a function that resizes images and calculates how much to scale it based on the file size. I need to pass this percentage as an argument to the ...
0
votes
0answers
7 views

notify-send not showing popup message

I have a script which executes on certain conditions, whenever I manually execute the script, the popup appears, however if i try to aumotate the script(i.e. run the script right after system is ...
0
votes
1answer
114 views

How to pipe arguments into stdin?

I am trying to generate a private key using keytool command, but it asks me for many details like my key passphrase, my name and my organization details. I want to pass all the inputs in one command. ...
0
votes
2answers
22 views

How to use crontab to launch scripts

I have created a script (which I already tested if it works) and I want to use crontab to launch it everytime my pc reboots. I created these script called test.sh just for fun and it's pretty easy: ...
0
votes
1answer
24 views

how can i get SYN & SYN+ACK value for current tcp connection of any website on Browser?

As I know that '$sysctl | grep net.ipv4.tcp' gives the system wide TCP parameter value,I need to make a script in Bash for my college practical file in which If we open Browser and input the ...
1
vote
2answers
34 views

Custom script run with sudo - command not found

Problem: Running a script as sudo returns sudo: mount-remove-hiberfile: command not found Info: Scripts folder: '/scripts' (all my custom scripts are kept here) My User: 'cybex' ...
1
vote
1answer
50 views

How do I close a windows program in BASH

I use X64-based Win10. Recently, I started to use git, so I am switching the console to bash/mingw64. But I don't quite understand the way bash behaves. I tried to kill a program, say notepad, via ...
0
votes
1answer
28 views

Why does terminal repeat “//: is a directory” after I source .bash_profile?

Sergios-MBP:~ home$ nano ~/.bash_profile Sergios-MBP:~ home$ source ~/.bash_profile -bash: //: is a directory -bash: //: is a directory -bash: //: is a directory -bash: //: is a directory -bash: //: ...
0
votes
0answers
16 views

Creating a bash script or something to run through several directories

I had a quick question. I have the code below, which as you can see, I am loading in a file. Note that I am in the folder "Angle1" and that I am in the subfolder "1eV" The code works fine and does ...
0
votes
0answers
27 views

Close process gracefully that has no window

So, I have a script that starts some auto-hotkey scripts while also starting up a game. I want those scripts to close again when the game ends. Currently I'm doing this with the kill command. This ...
15
votes
2answers
3k views

How to prevent clearing of terminal output when I “exit” an SSH session?

This is the situation: I open a terminal in Ubuntu, and do ssh host-1, which works as expected. From host-1, I do ssh host-2, which again works fine and connects me to host-2. From host-2 I do, for ...
4
votes
2answers
251 views

How to disable jobs killing when leaving the terminal

When I leave a terminal via Ctrl+D and there are jobs in the background I get There are stopped jobs for the first time, but when I press Ctrl+D again, the jobs get killed. Can I disable the latter ...
2
votes
1answer
23 views

How to set different shell prompt color for each newly opened terminal

I am using Ubuntu and can manually change the bash shell prompt color to green using export PS1="\e[0;32m[\u@\h \W]\$ \e[m" However, I want the shell prompt color to automatically change whenever I ...
0
votes
2answers
147 views

Open Ubuntu Bash's GUI applications on Windows 10

I have installed Windows 10 Insider build just to use Ubuntu Bash. I noticed its entire Ubuntu on Windows so I tried to install a GUI app i.e. Gedit. It was installed properly but when I try to open ...
0
votes
2answers
15 views

cron job on centOS 6.5

I have used these 2 references to insert a new crontab entry. redhat ubuntu I have created a new bash file and moved it to /usr/bin. That sh file has execute permissions for the root user and the ...
23
votes
10answers
25k views

.bashrc not sourced in iTerm + Mac OS X

I am using iTerm in Mac OS X 10.6. It seems when i open iTerm, neither .bashrc nor .bash_profile is sourced. I can tell because the aliases defined in .bashrc don't work. How to fix?
-3
votes
2answers
18 views

I need help building a regex for a grep to show only the path to running versions of java

I need help building a grep from ps -ef to return only java paths. Say we have the following runnning process: bash> ps -ef | grep java user pid# 1 1 00:00 ? 00:04:00 ...
2
votes
1answer
29 views

How get the value of TCP connection establishment timing,retry timing in ubuntu 14

how i get the value of TCP connection establishment timing ,retry timing for any TCP connection and also Quality of services parameters in Ubuntu .
6
votes
8answers
5k views

loading local shell aliases to ssh session dynamicaly

When I log in to some machine using ssh I wish my aliases and functions are there. In other words, log in to some machine I wish I can use my command shortcuts. I need it be dynamic, every time I'm ...
2
votes
2answers
3k views

Changing the HOME for Cygwin

I'm trying to change the home directory for Cygwin on a computer at work. Our home directories mapped to a network share by default. This seems to cause some confusion for Cygwin, as it created a ...
0
votes
0answers
15 views

Extracting zip files within zip files

I have a file which contains an unknown extremely high number of zip files, only within each other, and a file at the bottom, like so: ...
0
votes
0answers
15 views

Matching 3 or more words from fields in seperate csv files.

I have two csv files: This is csv1: 11, The Sun Still Shines in Reading, 64312, 464566 13, You and Me Together Again London, 564564, 131355 12, What's the Story Now Your Gone, 4545646, 1124545 17, ...
0
votes
2answers
21 views

Exclude a directory from `ls -R` command in FreeBSD

I want to list all of my files in a directory in FreeBSD 9.2, but I don't want to include a specific directory. I checked both -I and --ignore parameters for ls, but I only ignores superuser mode and ...
1
vote
1answer
27 views

How to use '!!' (double exclamation) in bash script?

This is the scenario: Sometimes I want to open a list of files using vim. That list of files is output of a command. So I can type vim $(!!) and open those files after running that command. Is it ...
9
votes
5answers
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 ...
1
vote
2answers
167 views

WSL(ubuntu/windows) AppData\Local\Lxss doesn't actually sync back to ubuntu, ideas?

If you create a file in bash (touch /root/foo.txt) that appears in the hidden directories in AppData\Local\Lxss\ modifying it there does not change it in bash. Worse if you change it again in bash ...
1
vote
0answers
40 views

How does OS X's Terminal pass the new tab's dir to login or bash?

In OS X, you can add a shell to /etc/shells and set it as a user's default shell, such that when they open the terminal they are presented with that shell. In addition, you have the option to open all ...
1
vote
2answers
100 views

Using NPM in the new Windows Bash

I've been playing around with the new bash terminal in Windows 10 to see if I can switch over to a Windows dev environment. Since the environment is fairly new and still in beta, it's been tricky to ...
1
vote
0answers
11 views

Acer Aspire One - Console Opens on Boot "Unable to open Display ' :0.0'

My mother just gave me her Laptop (Acer Aspire One ZG5) and showed me the following: I tried to change the hostname, which should be a solution for this problem, but I've noticed that I havent got ...
2
votes
3answers
35 views

How do I search for substrings in Bash?

I want to find out and display the total amount of TTT substrings found in the first 2,000 lines in the file. I had been using grep until I tested it, and realized it does not identify substrings.
0
votes
1answer
17 views

Creating another user for a certain domain

I typically tend to log in as root, which I know is bad practice. So I created another user, let's call it user1. Except now when I log in as that user I am placed in an empty /home directory and it ...
0
votes
1answer
23 views

How to create a “run as admin” bash shortcut

To run bash console (Windows) as admin in a project folder, currently I first launch bash as admin then manually navigate to the folder which is excruciatingly laborious. Any way to get a graphical ...
0
votes
0answers
24 views

How can I make git bash `which` command work with windows?

If I type which node in git bash in Windows, then I get node's path, but when I type which open, it says it's not found. The open program is in PATH, but not marked as executable since chmod +x ...
-1
votes
1answer
43 views

Why does this “find” command scan all directories?

I only want to recursively scan Documents and not leave that "parent" folder. My script scans recursively my entire file system, and I am not sure what element of this script is causing that to ...