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

learn more… | top users | synonyms

0
votes
0answers
15 views

bash script doesn't work unless bad command given

I have a script that doesn't work (it freezes my status line) until it is completely done. However, by adding a random bad command, e.g. asdfasdf anywhere in the file that the script reaches (i.e. ...
0
votes
2answers
12 views

list file and using awk to get comment

I want to get the all comment of all files in a folder. And what I have tried is ls -R | awk '/<!--/,/-->/' >> result But it shows nothing in the result file. But if I use the awk ...
0
votes
1answer
13 views

How to create a command shortcut in BASH or ZSHRC shells?

I know how to create an alias or a PATH however those are both used to navigate folders. How would you create a shortcut to say quickly type the following commands every time? alog = tail -f ...
0
votes
1answer
11 views

Bash command for replacing all non-printable characters?

I have a bash script that checks database for changes and emails me these changes. Works nice, until it tries to send something non-printable, which 'breaks' the mail. Is there any handy way how to ...
0
votes
0answers
18 views

How to move unopen files to another folder

I´m beginner in Linux and I want to build a script in bash to check which files are open in a folder and move any other files - those that are not open to another folder.
0
votes
0answers
9 views

SSH remote chroot without root

I have a dual boot system consisting of two Debian OSes. I've installed one of them in a root of the partition and installed the other Debian using debootstrap; the installation partition is called ...
0
votes
1answer
23 views

Start PuTTy session in remote host over network

I have 5 hosts - A, B, C, D and E. A and B are windows hosts. C, D and E are Linux machines running ssh server on port 22. I've copied plink.exe (putty command line backend client) in host B. When I ...
0
votes
1answer
7 views

openssl print numeric value of the key?

Given a file contains the public key, I need to get the numeric value of the modulus and the e. But I can only get something like this: $ openssl rsa -in key -pubin -text Modulus (2050 bit): ...
2
votes
1answer
37 views

Probing a port for RDP

I use an ssh tunnel to RDP into my home computer ("home"). Occasionally, the tunneling software running on home crashes and the RDP port stops getting tunneled. I've attempted to resolve this by ...
0
votes
1answer
17 views

readline - deleting word under cursor

E.g. Alt-d deletes word until next word boundary. There's also a shortcut to delete until previous word boundary IIRC, but I'd like to delete word UNDER cursor (i.e. to current word left boundary and ...
0
votes
1answer
21 views

Get the Group name which has GID=0

I wanted to write a shell script in which it needs to give the group name whose GID=0.I used awk command like this, awk -F ':' {$3==0} /etc/group | cut -d ':' -f1 It works fine in redhat,aix.But ...
0
votes
3answers
25 views

Is there an automatic way to add group read permissions to “nohup.out” when “nohup” is run?

I run my Java code from bash script using a command like this: exec nohup "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" com.myClass "$@" & Which creates the output file nohup.out and this ...
0
votes
1answer
31 views

bash shell error: “no such file or directory”

I am trying to install Virtualenv wrapper on Ubuntu 14.04. But whenever I start a terminal, I get the error saying bash: /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh: No such file or ...
6
votes
7answers
587 views

Remove linux file named with set of shell responsive characters

I've created a file named \;:$"\' to test a software of mine. I ended up with an error because I cannot delete the file property. I'm trying to find a precise char combination to remove via rm, but I ...
1
vote
3answers
19 views

Looping until background process is done (with `jobs`) doesn't work in script

I'm trying to loop until a background process (launched earlier in the script) is complete. An easily reproducible test case is: ping -c 10 localhost &>/dev/null & On the command line, I ...
0
votes
1answer
30 views

No such file or directory when executing an existing file

I have norrowed the error down to this from a larger script and I'm getting the error "No such file or directory" when I try to execute a file which exist and I have the correct permissions for. ...
0
votes
2answers
15 views

Append text to lines between two patterns every time they appear in a file

This will be a rather hard one, i guess. I have to fiddle around with inline documentation that is extracted into html files to be used as online documentation, but these parts of the files should be ...
0
votes
0answers
37 views

Unable to get vmware shared folders working in Ubuntu 14.10 Guest

i Installed Ubuntu 14.10 64Bit in VMWare Workstation 10.0.5 within windows 8.1 Enterprise. I installed vmware tools by running the vmware-install.pl script in terminal.But I am Getting an error ...
0
votes
1answer
17 views

Linux Bash: Moving/Copying files/directories by timestamp

This is the command I am using: find absolute-path -name "*" -amin -120 -exec cp -f absolute-destination {} \; I’m trying to copy a lot of directories from a directory to another directory, but ...
-1
votes
2answers
35 views

Apply command to every line in bash terminal

I've accidentally discovered the lolcat package today. The first thing that I though about is: it would be fantastic if i could pipe everything that comes from stdout to the terminal through lolcat ...
0
votes
1answer
23 views

Remote SSH Commands - bash bind warning: line editing not enabled

I am using bash 4.3.11(1) and have the following history plugin installed (via .bash_it): # enter a few characters and press UpArrow/DownArrow # to search backwards/forwards through the history bind ...
2
votes
1answer
74 views

What is the scope of “exported” in Unix shell variables?

I have set some environment variables in the following way: MY_VAR='helloworld' export MY_VAR Then I have switched to another user via su SOME_OTHER_USER I echo the MY_VAR variable.. and I see ...
0
votes
0answers
15 views

Can’t cd, ls, chown/mod or rm directory — Unknown error: 211 in Mac OS X

Never seen something like this in all my years. This is happening in Mac OS X: $ ls -lO@ea dr-xr-xr-x 2 root wheel - 1B Mar 20 23:10 Music/ $sudo cd Music/ cd:13: unknown error: ...
3
votes
1answer
30 views

What's the best command to discover an application's PID?

Just now, I encountered a bug in Google Chrome. For whatever reason, my Chrome tab, which was open to StackOverflow, created an infinite loop of "Are you sure you want to leave this page?" prompts. ...
0
votes
3answers
66 views

BASH script - execute command in variable

I am doing a bash script to backup my database daily(on Mac OS X) and I want to save the newest 7 backup directories. Here is the problematic fragment of my script(for listing everything but the ...
1
vote
1answer
24 views

How to correct malfunctioning Terminal in Mac OS X?

I am using Mac OS X 10.10.2 (Yosemite)—not a server version of the OS—and standard “Terminal” commands like ls, sudo, cp, mv, rm are no longer recognized in my Mac “Terminal.” I face this problem ...
0
votes
0answers
20 views

how to find packages in subdir with a particular dependency

From the root of new SLES media how is it possible to find all packages with a particular package dependency? That is, there are many RPMs in various sub-directories of root. How may I find all ...
0
votes
3answers
25 views

How do I move files from many child directories into my root directory?

I'm using bash on Mac 10.9.5. I have PDF files in many directories, all one level from the root ... Dir_1/abc.PDF Dir_2/def.PDF Dir_3/ghi.PDF Dir_3/jkl.PDF ... How do I write a shell command to ...
-1
votes
1answer
26 views

for loop in if else conditions in bash [closed]

I'm trying to script the following task. I have a file in which node name and ips are updated, I have to make each file of those nodes which are not in our required directory and those are in updated ...
-1
votes
0answers
9 views

How to remove the source file when converting with LAME via Automator and a shell script?

I have been trying for hours, doing searches on Google, but I can”t find the syntax. I am doing an “Automator” workflow, and I have this code in a Shell script:
1
vote
1answer
23 views

Difference between : and := with variables in bash files

I came across a bash file which has something like this MYVAR := SomeVal I know after reading some tutorials you set values as such MYVAR = SomeVal What is the difference between the above two ? ...
0
votes
1answer
38 views

Non-interactive ssh sessions don't have PATH set on some systems

I set my environment in .profile. My .profile is idempotent and .bash_profile, .bashrc, .kshrc and .zshrc all source .profile. That way I always get the same environment regardless on what ...
2
votes
3answers
46 views

Apparent .bash_profile and .profile conflict in Mac OS X

I have an issue where, when I load up new terminal windows, I have to source the ~/.profile to get my PHP path working correctly. In essence of my issue is getting terminal to use MAMP PHP and MySQL ...
0
votes
1answer
33 views

Download multiple files from ftp server with bash script

I have 2 or 3 FTP Servers where our hoster puts database backups each day. Since he only keeps one, I was orded to write a bash script for downloading alle database backups every day so we have more ...
0
votes
0answers
19 views

static ip address disappeared in the middle of running iperf

The following is done on iperf client side. I set the static ip address for eth0 by modifying /etc/network/interfaces, and activate the change by doing ifup eth0. Then I start iperf -c $server_ip -t ...
0
votes
1answer
26 views

Python debugger not stopping at breakpoints

I'm in a linux based development environment where I don't have superuser permissions. My basic issue is that the breakpoints I set in emacs through pdb never work. The debugger never halts at those ...
0
votes
3answers
75 views

Print previous 20 lines of text from a certain point of a text file

Currently: I'm new to scripting, teaching myself as i go along and this is my first script I'm developing. What my script is trying to do is look at specified file, scan the file to find the word ...
0
votes
1answer
10 views

What is KNOPPIX shell's start-up file?

I'm trying to install virtualenvwrapper and I got to change the settings of my shell's start-up file (like .bashrc, .zhrc, .profile, etc) to write this: export WORKON_HOME=$HOME/.virtualenvs export ...
1
vote
0answers
26 views

Expression within shell script [migrated]

I have just seen this code, but i can't get my head around how this code can actually work. For my understanding it shoud just echo out everything, or am I wrong? deleteOldDumps(){ local SYSTEM="$1" ...
1
vote
0answers
14 views

How to show git branch in Emacs shell

How can I show the current git branch as part of the Emacs shell prompt? For example, I have this in my ~/.bash_profile (I'm on Mac OSX 10.9 Terminal): parse_git_branch() { git branch 2> ...
0
votes
1answer
13 views

zsh completion for all executables in path

I have written a script which itself takes as an argument any arbitrary executable in my $PATH. Is there a way to create a zsh (or bash) completion function such that I would be able to type myFunc ...
-1
votes
0answers
25 views

Undoing a sudo command

In a fit of frustration, while installing node via nvm, I followed the steps listed in a Digital Ocean post: I am most concerned about this command: n=$(which node);n=${n%/bin/node}; chmod -R 755 ...
1
vote
0answers
17 views

Can I have server and client on the same machine and run network bandwidth test using iperf?

I have two ethernet ports (eth0 and eth1) on my system. I've tested the bandwidth with two systems and got ~940Mbit/s. If I use one of the ports as server and the other as client, I always go through ...
0
votes
1answer
50 views

Percent sign in bash is not typeable

I have a strange problem: I cannot type or copy the percent sign in my bash... I tried to read ~/.bashrc, /etc/profile (and stuff in /etc/profile.d). I also tried sudo bash, but still not possible to ...
2
votes
1answer
74 views

How can I check if a file is newer that the target file in a shell script

How can I check if a file is newer that the target file? In a shell script, intended to run on a Mac, I want to do something like this: #!/bin/bash if [ $SourceFile dateisgreater $TargetFile ] then ...
1
vote
2answers
18 views

How do I output this line to a remote file?

I'm using a bash shell and trying to figure out the right way to write the following: ssh mysuer@remotehost 'echo "update user set url = \'localhost\' where url = \'mydomain.com\';" >> ...
0
votes
3answers
38 views

Multiline && combinator operator for command chaining in batch file

I see that this operator is used in windows (and might be Linux?) to chain/combine multiple commands in one line. Commands are executed one after another, as long as preceding complete successfully ...
0
votes
1answer
26 views

How is the “builtin” bash command defined?

I noticed that command like cd .. is actually converted to builtin cd .. and then executed. But how is builtin defined? which builtin doesn't show anything and it's not in /bin, /usr/bin etc. Is it ...
1
vote
0answers
27 views

Cygwin and Cygwin64 missing prompt in terminal

I tried to install and reinstall cygwin and cygwin64. I also tried different mirror sites. Instead of seeing a line like user@PC~ $, I see a blank screen with a blinking cursor. The properties of ...
0
votes
1answer
22 views

Duplicate a remote session in terminal in Linux (Ubuntu)

How do I duplicate a remote session in the Linux (Ubuntu) terminal? For example, if I have an SSH session open, how can I duplicate this session in the terminal?