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

learn more… | top users | synonyms

0
votes
0answers
33 views

Windows capture flags and pass them on

In order to lint C files, Atom wants the executable path of Clang, which I want to run with Bash on Ubuntu on Windows. I figured out I could use bash -c "clang" to run it, but how can I capture flags ...
1
vote
1answer
91 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
0answers
29 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
32 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 ...
2
votes
1answer
37 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
36 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 ...
0
votes
1answer
47 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: //: ...
-3
votes
2answers
25 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
2answers
50 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
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
19 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, ...
2
votes
1answer
40 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 .
1
vote
1answer
34 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 ...
1
vote
0answers
15 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 ...
0
votes
2answers
31 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 -...
0
votes
1answer
20 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
0answers
73 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'...
0
votes
1answer
32 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
1answer
33 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
24 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
46 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
28 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
29 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 ...
-1
votes
2answers
95 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' ...
1
vote
2answers
258 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 ...
0
votes
1answer
44 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 ...
1
vote
1answer
43 views

Matching a randomly generated integer with a specific place value in a string

In bash I want to prompt user for input in a script. Lets say the input is: #!/bin/bash echo "Please enter a number." read NUM # User enters "12345678" How can I use the next command to generate ...
0
votes
2answers
73 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: ./...
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 &&.
2
votes
2answers
374 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
1answer
35 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 ...
-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....
1
vote
0answers
42 views

Purpose of function export in bash

If we take a look at the following example: # testing(){ echo hello;} # testing hello # echo $(testing) hello # echo testing >script # ./script ./script: line 1: testing: command not found # ...
0
votes
1answer
29 views

Alias to attempt mounting multiple times doesn't work correctly

I have the following in my .bashrc alias ext='sudo mount /dev/sd'{b..d}'1 /ext/hdd || sudo' I intended the alias to mount my external hard drive without having to worry about the semi-random ...
0
votes
1answer
35 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: ...
2
votes
1answer
28 views

Tmux - Detach client fails if using bash startup script

Typically, I use a bash script to create my tmux session (split panes, set PWD, call commands, etc.). This works great, except if I try to run tmux detach-client. It will fail to detach, instead just ...
1
vote
2answers
52 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
0answers
16 views

linux + verify by ssh the remote machine configuration

what is best way to verify if the remote machine is cluster machine I just create the following ssh command to verify if the remote machine is VRTS cluster or Linux availability Red Hat cluster ...
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
21 views

How to iterate through Hosts in .ssh/config

On some of my remote servers I use Git to keep commonly used scripts in sync. I would like to have a local script that I can fire to update all remote servers that that are within one domain range. ...
0
votes
1answer
20 views

Why are spaces not allowed while setting up aliases in .bashrc

Coming from the Windows world, I tend to type cls to clear the console. I wanted to set up an alias so cls would still work. I read an article online that mentioned you cannot have spaces between the ...
0
votes
0answers
31 views

Full text, dynamic, RSS feed generator

I am looking for a solution to produce and update regularly full-text RSS feed. The goal is to provide full text feeds from a variety of websites to my canto rss reader. There are several services ...
1
vote
2answers
23 views

when performing a read command from within an xterm -e, it doesn't store the result of the read

When running the following in #!/bin/bash xterm -e "echo 123;read ANSWER;echo answer=$ANSWER;sleep 5" I get these results in an xterm window (no matter what i type for the read). 123 answer= So ...
1
vote
1answer
49 views

How to run a sequence of bash scripts one at a time in Linux?

I have several bash scripts, or rather one script that has to be run multiple times. This script accepts several command line arguments and does something with them. I need to run this script ...
0
votes
2answers
44 views

In bash, how to combine the output of two commands and append them on the SAME line of a file?

For example I have two commands here: { command1 & command2; } >> file1 For example the output of command1 is 400, and the output of command2 is 4. So this is what I get: 400 4 I want ...
0
votes
0answers
23 views

bash: illegal character in an environment variable

According to man bash, bash identifiers may consist: "only of alphanumeric characters and underscores", however, bash seems to have been tolerant to this up until shellshock patch. Actually, it still ...
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/...
1
vote
2answers
48 views

Source by bashrc when I exit an ssh session

I'm on OS X and using iTerm2 I've updated my bash profile on several of my servers so that when I ssh into them I can tell at a glance from the tabs what boxes I'm on. when I exit from an ssh session,...
0
votes
1answer
51 views

How to transparently substitute sha1sum for shasum in sh shell?

I have a test that needs to run on multiple platforms. On all other platforms, the test uses sha1sum, but on my Mac OSX El Capitan, there is no such program installed, but shasum works fine as a ...
0
votes
1answer
26 views

How to erase certain lines from 10000 files efficiently

I have 10000 files in a directory. I would like to erase lines so that I keep 2 lines in the header, 2 lines at the tail, and every 100th line in the middle. For instance: #header1 #header2 0 x ...