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

learn more… | top users | synonyms

1
vote
0answers
8 views

`qsub` leaves “NotQueued ” in “blocked jobs”

I am working on a remote cluster (westgrid > bugaboo) on which I submit processes via a .pbs file. My .pbs looks like this #!/bin/bash #PBS -l procs=1 #PBS -l walltime=100:00:00 #PBS -N ...
0
votes
1answer
19 views

Changing my shell bash script default $PWD to it's (the script's) current location

Hey I'm running my shell script that interacts with folders and files, but my $PWD that it keeps pointing to /home/MyUserName directory and this messes with what it is supposed to do. I am running ...
-1
votes
0answers
20 views

An Executable to clean up ram in MAC?

I was searching if I could clean up RAM with terminal and I came across few resources. I found one way it could be done is to use the command sudo purge in the terminal window, but I really don't ...
1
vote
2answers
53 views
+100

Cygwin paste long line is inserting newline at wrap point

I'm having issues with Cygwin's Copy/Paste functionality on a fresh install. If I scrunch my cygwin window small, and then type a command that is wider than it is (such as echo ...
0
votes
1answer
12 views

Pattern search the user input in a file in Unix using awk

I am trying to write awk script to search for a pattern that is given input by user, in a file. My code look like this: awk 'BEGIN{printf "Enter : ";getline input<"/dev/tty"} /'"$input"'/ {print}' ...
0
votes
0answers
11 views

What is the difference between \e[38;5;175m and \[\e[38;5;175m\] as it relates to bash colors?

I have been trying to learn how to customize my shell and I came across two different ways of specifying colors in the Bash shell. They both seem to accomplish the same goal and I am not sure what (if ...
3
votes
4answers
9k views

Redirect stdout while a process is running — What is that process sending to /dev/null

I've run a command and redirected it's output via > /dev/null Now that it's been running significantly longer than I expected I want to see what it's doing. Is there a way to re-redirect the ...
4
votes
2answers
4k views

Linux startup script to connect to bluetooth and cron to keep it connected

I have a mini Bluetooth keyboard and a Raspberry Pi running a Debian-based distro. I know the MAC address of the keyboard but for this question, let’s just use AA:BB:CC:DD:EE:FF. Right now I have to ...
0
votes
0answers
15 views

Background process with stdOut/StdErr output in files and console

I want to SSH into a machine, start a process, write the stdErr and stdOut of the process into two seperate files while reading the stdOut/stdErr in the console. As soon as some specific lines were ...
0
votes
1answer
18 views

Can we install a package through a shell script? [duplicate]

I'm trying to write a shell script so that when I reinstall my Ubuntu again. I could just run script and retain all the packages. And I'm planning to pass password in form of argument. My question ...
0
votes
0answers
11 views

How to have error output from `ls` if target directory is empty

I'm currently learning how to use the Linux shell, getting to grips with the basic commands like cd, ls and pwd. My file structure is like so: user |-- documents |-- file1.pdf |-- file2.txt ...
0
votes
2answers
23 views

tail/head all line except X last/first Lines

for example i have this file : cat myfile 1 2 3 4 5 i want to print all lines except first 2 line . output should be like this : tail -n $(( $(wc -l myfile | awk '{print $1}') - 2 )) myfile 3 4 5 ...
1
vote
3answers
346 views

cygwin's chmod behaves as working, but it does not work

My Cygwin installation is behaving strangely: chmod does not work. [09:45 Administrator@DellIns14 ~] > ls -ls /usr/bin/chmod 64K -rwxr-xr-x 1 Administrator None 38K Feb 6 2012 /usr/bin/chmod ...
0
votes
3answers
3k views

bash No space left on device

On VPS when I press tab under my user I get: bash: cannot create temp file for here-document: No space left on device but it works fine under root, what's happening?
0
votes
1answer
83 views

Zip epub using 7zip and issue with exlude file

I've many epub as folders need to convert it to .epub compressed so i created bash script to that ..which are compress the epub folder to zip then rename it to .epub using 7-zip btw i was try to use ...
0
votes
2answers
22 views

why doesn't xterm work with my script?

my script : echo 123456 > /folder/folder/123.txt I ran the script with xterm: xterm -e my.sh & It doesn't work.
0
votes
1answer
32 views

Using windows Git Bash in MobaXterm

I have custom macros etc in my mobaxterm, but I have worked for a half a year on a remote linux machines, now I have my code on my local PC and I use git bash. Can I use it through MobaXterm?
0
votes
2answers
10 views

find -exec where filename is not the last parameter

I am trying to pass the files from find command to adb push like this: find . -name "test0[4-8]*.py" -exec adb push {} \; /storage/emulated/0/ I get an error find: paths must precede ...
0
votes
1answer
25 views

How to pipe binary stdout to a compressed tls connection?

Not so long ago, I could use : cat somefile.txt | openssl s_client -connect server:port -quiet -comp However, this command doesn’t work, even with-ign_eof: $ cat somefile.bmp | openssl s_client ...
1
vote
1answer
14 views

Execute SSH port forwarding along with the browser

I've successfully set up dynamic port forwarding over SSH in Pale Moon and added the alias as ssh-forward in .bashrc. Now I have to execute both ssh-forward and palemoon to access the Internet over ...
0
votes
2answers
22 views

From logs, extract specific line after a grep by line number

I have a file, debug.log, from which I want to extract all the lines that immediately precede a specified pattern. Example: 1 blabla 2 blabla 3 HERE THE IMPORTANT THING 4 HERE IT MATCHES MY PATTERN ...
2
votes
3answers
3k views

Mounting a remote filesystem on Windows 10 using Bash

Now, that windows 10 is out I started wondering about something. Unix based systems have the possibility to mount remote filesystems using ssh. In a recent article I've read that Windows 10 Has ...
1
vote
1answer
11 views

grab history command and args for different commands

I have the following exercise: 47 vim wilson.0321 wilson.0329 I need to grab the last command and args to create: vim wilson.0329 right now I can grab the last arg or entire command: ...
8
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 ...
2
votes
2answers
367 views

Working shell command doesn't alias

I can run, svn status |grep -v .jasper$ |cut -d ' ' -f8 |sed '/.*\..*/!d' |xargs ls -altr --color=auto just fine. But when I go to add this as an alias (alias svtr="...") I get an error saying... ...
-1
votes
0answers
21 views

monitoring websites using curl [on hold]

I am looking to monitor about 40 (Linux/Apache) urls hosted in a DMZ. I am thinking of using curl from a Linux box in the DMZ to do this and pass the data to a monitoring tool. My plan is to use a ...
3
votes
4answers
8k views

When running `rm -rf`, is it possible to exclude certain subdirectories?

I routinely use bind mounts to aid in making space available in multiple locations without having to have multiple logical volumes / physical partitions / LUNs, etc. For example, I may have a 200G LV ...
0
votes
1answer
6 views

lost virtualenv display to the left of bash prompt

I added thy Holy prompt to display my current branch so I never push to master. We all use it and it works, but I am no-longer seeing what virtualenv I'm using at the moment, which is a hassle. Based ...
5
votes
4answers
5k views

“watch” the output of a command until a particular string is observed and then exit

I'm looking for a way to programatically watch the output of a command until a particular string is observed and then exit. This is very similar to this question, but instead of tailing a file, I ...
3
votes
1answer
29 views

How to pipe AWK command output to Python as first argument

I have a plain text file input.txt which looks like: D000001 D000001 44 1975 D000001 D000408 1 1983 D000001 D000641 1 1977 D000001 D000900 27 1975 I process this file using simple AWK line: awk ...
1
vote
1answer
141 views

Send keystrokes to two windows at once

What I want to do: Be able to enter keystrokes while one program is in focus, but also send the same keystrokes to a second program on the other screen. What I have tried: xvkbd - I've tried ...
27
votes
7answers
74k views

How can I use a bash like shell on windows

I use Linux and a Mac. I'll be teaching some command line stuff soon. What can I install on Windows to give me a terminal window most similar to a basic mac/linux bash shell. Would like to be able to ...
0
votes
1answer
3k views

bash- how can I use wget to send POST data with files?

I want to make following POST request to my server using wget: email=abc@abc.com&file1=@FILE_HERE&file2=@FILE_HERE In above request, there are three POST parameteres called email , file1 ...
0
votes
0answers
17 views

How to expand a loop iterating over an array dynamically in BASH?

I need to iterate on an array and expand the array while iterating. How do I do it in BASH? For example: req="a b c d" read -a MODULES <<<$req for MODULE_NAME in "${MODULES[@]}"; do ...
0
votes
1answer
159 views

Force download Windows update to build 14316

I’d like to try the new Ubuntu Bash on Windows, I’m already on the insider preview program and every time that I do a “check for updates” I don’t get any new update. My current build is 10585.218 and ...
0
votes
0answers
23 views

Update Azure VM running Windows 10 Enterprise N to build 14267?

I have Windows 10 Enterprise N running in an Azure VM and I'd like to update it to a newer build so I can try out Bash for Windows. It's setup to receive Insider Preview builds and its set to the ...
1
vote
2answers
126 views

Windows 10 build 14316: Ctrl + v doesn't work on Bash on Ubuntu on Windows

On the new Windows 10 insider build 14316, I haven't been able to use Ctrl + V (shortcut for paste) on the new Bash on Ubunbu on Windows app. Has anybody else had this issue? Any solutions? I have ...
7
votes
1answer
4k views

Equivalent of bash's `source` command in Powershell?

To run a bash script line-by-line (so as to preserve environment variables, for instance), one does the following: $ . myscript.sh Or: $ source myscript.sh I have a PowerShell script that - ...
9
votes
1answer
493 views

How to remove/reset Windows Subsystem for Linux on Windows Insider Build 14316

I installed the Windows Subsystem for Linux on Windows 10 Insider Preview build 14316. Now I would like to remove it or, better, revert to its factory defaults i.e. as it was when just installed. I ...
0
votes
1answer
16 views

Run script without typing sh on Android

I wanna run my script which is located in system/bin and permissions is 755. With sh myscript there is no problem but myscipt or ./myscript doesn't work even if the pwd output is /system/bin. On ...
-3
votes
1answer
42 views

What is the use of Bash in the next update for Windows 10? [closed]

In the Build conference this last month, Microsoft said that Bash was going to be introduced in to the anniversary version of Windows 10 in July. And I thought to my self, would this be an advantage ...
1
vote
0answers
10 views

tmux: get names of panes, each current directory and history

my tmux session is a bit broken, by which I mean that tmux ls returns an error like error connecting to /private/var/folders/d0/xbg08_x12lddw3dkht5w462c0000gn/T/tmux-501/default (No such file or ...
12
votes
6answers
14k views

Copy files in Linux, avoid the copy if files do exist in destination

I need to copy a /home/user folder from one hard disk to another one. It has 100,000 files and around 10G size. I use cp -r /origin /destination sometimes I get some errors due to broken ...
74
votes
4answers
80k views
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
0answers
21 views

Launch agent to run a .sh when it is added to a folder

I am trying to create a launch agent that will monitor a folder for when a .sh file has been added to it and then run it. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC ...
0
votes
1answer
12 views

Nano does not resize to window size in bash on OS X

Any ideas on how I can fix this? I am not sure what to google for =[
1
vote
1answer
16 views

How to pass array to bash shell script?

How do I pass an array as a variable from a first bash shell script to a second script. first.sh #!/bin/bash AR=('foo' 'bar' 'baz' 'bat') sh second.sh "$AR" # foo sh second.sh "${AR[@]}" # foo ...
1
vote
1answer
14 views

Accessing array index variable from bash shell script loop

I want to access the array index variable while looping thru an array in my bash shell script. myscript.sh #!/bin/bash AR=('foo' 'bar' 'baz' 'bat') for i in ${AR[*]}; do echo $i done The result ...
1
vote
1answer
112 views

How can I create Keychain entries via command line?

I am trying to use the command line to automatically add passwords to the keychain app for various file servers. I was able to use the man security to figure out most of it. It's creating the ...