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

learn more… | top users | synonyms

1
vote
0answers
19 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
37k 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
31 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
15 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
133 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
40 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
28 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
54 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' cybex@cybex-...
1
vote
1answer
82 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
39 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
20 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
31 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
259 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
32 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
26 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 ...
25
votes
10answers
26k 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
24 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 /path/to/java/...
2
votes
1answer
33 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 ...
0
votes
0answers
17 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: zipfile\zipfile\zipfile\zipfile\zipfile..........etc.etc.\...
0
votes
0answers
17 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
27 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
31 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
0answers
42 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
174 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
14 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
38 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
19 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
29 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
66 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 doesn'...
-1
votes
1answer
47 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 occur....
0
votes
1answer
30 views

How to remove file on Linux with ? in name

Cannot move or remove file with ? in name. Any ideas? Have tried the following: # ls manager?%80%99s-viewpoint.html what-wcsap-can-offer-you-?%80%93-guide-new-directors.html # mv manager\?%80%99s-...
0
votes
0answers
17 views

GPIO on openwrt like on DD-WRT

On DD-WRT i can control LEDs by command gpio enbale X gpio disable X But on OpenWrt it does not work. -ash: gpio: not found I have tried opkg install gpio but it does not work (Package does not ...
1
vote
1answer
42 views

Permission denied when trying to read temporary file created in bash

I am trying to write a script which takes as arguments one or more files and transposes the upper case letters to lower case letters. The contents of the original file is replaced with the lower case ...
0
votes
1answer
25 views

Linux suppress find error in bash script combined with file delete

I have a one line script which works fine but... find $HOME/html/mydir/downloads/sec/*.zip -mtime 2 -exec rm {} \; It generates an error if there are no files found and my web host then sends me a ...
0
votes
0answers
21 views

Can MobaXTerm set environment variables on SSH connection?

It is possible for the OpenSSH command to set variables for a connection (e.g. http://superuser.com/a/163228/7173). Is it possible for MobaXTerm to do the same? The commands I run to setup my profile ...
0
votes
2answers
400 views

How do I call function after prompt for input in a Linux shell script?

The title says it all. After Im prompted, I want yes and no to respectively call a function. # Check to see if you ran this script before echo echo I need to know if this is your first time... while ...
8
votes
2answers
25k views

How can I compare a variable to a text string, rather than integer, in an if/else statement?

In the process of writing a shell script, I ran into an issue with the following if/else statement that falls somewhere in the middle of the script: if [ $act -eq "add" ] then read - "add or ...
-1
votes
2answers
79 views

echo $path returns blank on Mac

echo $path is returning blank for me. The following are contents of my .bash_profile. CHANGE PROMPT export PS1="►►" export TERM=xterm-color export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32' ...
0
votes
1answer
32 views

Sending gist to github via cURL and issues with new lines inside file

So, let's say I have an index.php file containing this: <?= "Hello" ?> <?= echo "WORLD" ?> And I wanted upload the contents of this file to my gists in github, which I am doing via ...
40
votes
5answers
4k views

How can I make my own “shell commands” (e.g. mkdir/cd combo)?

I can't tell how many times I have wished for a command that would both create a directory and move to that directory. Basically, I would like the equivalent of the following: mkdir -p /arbitrarily/...
0
votes
2answers
69 views

SSH Difference between ./ and sh

I wrote simple file "hello world" and try to execute it on virtual server by SSH. #!/bin/bash echo "Hello world" Of course I give chmod +x Then on one server I try to execute it by command: ./...
1
vote
2answers
48 views

Cronjob not running script

I've created a script to get my external IP address, check if it's changed and if it has, email it to me letting me know. Here's the script, aptly named ip.sh (server hostname is "odin"): #!/bin/sh ...
0
votes
1answer
32 views

What does this bash command do?

I accidentally typed the following. What does it do? gulp lint &7 gulp test I intended to type &&.
15
votes
3answers
21k views

How to do Page-Up on a Mac in Terminal

The laptop has no page-up/down buttons. How can I have page-up/down on the terminal, e.g. when I edit with vi?
2
votes
1answer
69 views

How to disable automatic escaping of quotes - BASH

I have this test code in my bash file: gtest() { echo 'hello' } bind '"\C-g\C-x": "$(gtest)\e\C-e"' When I start typing something like vim ", and then press C-g C-x, I get vim hello instead of ...
0
votes
1answer
31 views

Automated way to run bash script inside Ubuntu hosted in VirtualBox?

I have Windows 7 as host OS, and Ubuntu 14.04 as guest OS running under VirtualBox, I have some shared folders with data between Windows and Ubuntu and some binary in Ubuntu that do some processing of ...
0
votes
1answer
27 views

VSFTPD Refusing Connection Debian

Trying to setup VSFTPD to use with ShareX for file and image uploading. When checking on the status i get this root@vps:~# /etc/init.d/vsftpd status ● vsftpd.service - vsftpd FTP server Loaded: ...