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

learn more… | top users | synonyms

2
votes
3answers
322 views

Shell script not running as by “./” but it runs by “sh”

I am running a script on arm target board as a super user, i.e., as a root user. But the script is not executing if i run it with following syntax root@freescale$ ./Script.sh -sh: ./Script.sh: ...
0
votes
2answers
422 views

SSH commands with bash

I have a list of servers in a .txt file. Assume that the authorized keys are all in place in the servers. #!/bin/bash while read server <&3; do #read server names into loop [[ $server =~ ...
1
vote
3answers
124 views

Use latest version of package in bash script

The installed package libnet-amazon-ec2-perl uses v0.14.1. How do I update this package to use the latest stable release v0.22.1? When I try sudo apt-get --only-upgrade install ...
0
votes
1answer
120 views

Cygwin Syntax Trouble

I'm on windows 7 using Cygwin. My script and text file are located in the same directory. #!/bin/bash while read name; do echo "Name read from file - $name" done < /home/Matt/servers.txt I get ...
1
vote
3answers
314 views

Line by line not working

Script FILE="/u0146121/bin/list.txt" while read line; do echo $line done < $FILE I am new to bash scripting and trying to figure out this while loop. I want to read line by line from a text ...
1
vote
1answer
181 views

Red5 on Debian, output PID

I'm fumbling my way through with this one, as a novice with all things linux so please be patient :) I would like to output the process ID of a program to a file. From my readings this is generally ...
2
votes
1answer
111 views

Cannot type a letter while in Bash in Cygwin

I am unable to type a certain letter while in bash. I was editing .bashrc, or possibly .profile, which made it impossible to press the letter "a" (it is not showing up on screen, although I am able ...
2
votes
3answers
543 views

log execution of certain commands on linux

I have to maintain a system (debian) on which several users are allowed to install programs - so I would like to log, for example, if anyone executes "apt-get install" or "apt-get purge", so I can ...
4
votes
1answer
282 views

Bash: color prompt and command differently from output stream

I'd like to color the prompt and command of my shell differently from the text printed in the output stream. My current export for PS1 is as follows: export PS1="\e[0;36m\h:\e[m ...
0
votes
4answers
2k views

How do you pass a file or folder containing whitespace as an argument to a command-line program in a GNU/Linux or Cygwin environment?

There are occasions when you are working with files and folders that contain spaces in them. The problem is any time you try and pipe files / folders containing whitespace to another command-line ...
-2
votes
2answers
104 views

Looping and reading by line in Bash [closed]

Read a file of server names (.txt) line by line loop through each server name and connect by ssh Any suggestions, comments, and ideas?
2
votes
2answers
254 views

Is it possible to have App-distinct Color Scheme in ConEmu?

I am presently using Bash (with Cygwin), as well as Powershell, both using ConEmu. I'm using bash.exe and powershell.exe via tasks. I'd like to use different colour schemes for the different ...
1
vote
0answers
281 views

ssh Prompts For Password After Account Unlocked - Despite ssh key?

Here's what happened: I set up ssh key so that user could ssh from A to B without a password. I got user's password wrong in some other context too many times, and user's account got locked out. ...
-1
votes
1answer
2k views

find: ‘ls’ terminated by signal 13 error [duplicate]

My Script log=$HOME/Deleted/$(date) find $HOME/OldLogFiles/ -type f -mtime -7 -exec ls -latr {} \; -exec echo was deleted on `date` \; -exec rm -f "{}" \;|paste - - >> $log My goal for the ...
1
vote
1answer
265 views

Clean logging with BASH

I have a script that deletes files 7 days or older and then logs them to a folder. It logs and deletes everything correctly but when I open up the log file for viewing, its very sloppy. ...
1
vote
2answers
763 views

Accidentally copied files over /bin/bash in OS X

I mistakenly copied two files over /bin/bash. This now made my terminal non-responsive. I've followed this tutorial but it didn't help. For reference, the files are runcocoa.sh and runc.sh to be ...
1
vote
3answers
167 views

How to create a series of commands in shell, which will stop execution on error

My usual git workflow for deploying is the following: [while on master branch] git pull git push git checkout production git pull git merge master git push Would it be possible to create a ...
0
votes
1answer
172 views

In Bash, how do I pass the output of the first command to a command line argument of the second?

For example: mycommand.py -a `cat myfile.json` In this example, I need the contents of myfile.json to be passed as the value to the -a argument of mycommand.py. This almost works, but I need the ...
3
votes
3answers
2k views

PuTTY not sending Esc

I SSH with PuTTY from my Win7 x64 laptop to a Unix environment for my office. The problem I'm facing is very similar to this post where I cannot send an Esc character to the terminal. I first noticed ...
2
votes
3answers
139 views

I used mv ./*/* to flatten a directory on a ntfs filesystem, without add . to the end of the command, now all of my files are gone

How can I recover these files? I used: mv ./*/* when it was supposed to be mv ./*/* . Now all of my files are gone.
1
vote
0answers
71 views

Bash Shell doesn't recognize the letter “t”

I have Cygwin running on a Windows 7 Box. In what is a relatively new (and strange) development, the bash shell stopped recognizing the lowercase "t". For example: I type echo cat, output is ...
5
votes
2answers
16k views

Cygwin Dos2Unix Command not found

I am having some problems using cygwin. I am trying to use the dos2unix utility and cygwin is throwing -bash: dos2unix: command not found When I go back into the installer and look through the ...
0
votes
5answers
4k views

Moving a file using PuTTY

I am newbie struggling to move a file on a Linux VPS using PuTTY. I can log in with a user in PuTTY at this point I can navigate to see the file I wish to move ...
1
vote
1answer
423 views

Rundeck get verbose output of command executing on node

I have Rundeck executing a remote script, which is in python is using print statements to return output normally such as: $ python mytest.py PASS: Condition 1 passed PASS: Condition 2 passed PASS: ...
0
votes
1answer
6k views

How to start a service at boot time in ubuntu 12.04, run as a different user?

I have a server ClueReleaseManager which I have installed on a Ubuntu 12.04 system from a separate user (named pypi), and I want to be able to start this server at startup. I already have tried to ...
-1
votes
1answer
151 views

Can't load a .bash_profile on windows powershell

I'm looking to load a .bash_profile with some aliases and functions on launch but, I haven't been able to find a way to load the .bash_profile. I'm not even sure if it is possible.
2
votes
2answers
3k views

Print full path of files and sizes with find in Linux

Here are the specs: Find all files in / modified after the modification time of /tmp/test, exclude /proc and /sys from the search, and print the full path of the file along with human readable size. ...
2
votes
2answers
5k views

bash or bash_profile JAVA_HOME permanent export

I tried to export JAVA, used this JAVA_HOME=/etc/jdk1.7.0_07/ export JAVA_HOME export PATH=$PATH:$JAVA_HOME/bin It seems like it works just for while, after I close my console have to do this ...
1
vote
1answer
380 views

Is there a way to limit maxdepth for ls -Rhal?

Is there a way to limit maxdepth in a ls -Rhal command? I am aware of find . -maxdepth, but I want to be able to get the file information that comes with ls -Rhal.
4
votes
2answers
392 views

Bash command substitution not working as expected

I'd like to view the last few lines of a file, but I want the columns aligned. Basically, I want to disable wordwrap. This is straightforward with: tail $FILE | cut -c -80 But I'm trying to ...
1
vote
1answer
42 views

Viewing the ASCII codes of piped-in characters

Is there a command that would let me see ASCII values of characters outputted from a program? Say I pipe in a NUL character and a p, could I get a 0 and a 112 out?
1
vote
0answers
110 views

Getting bash history-complete-backwards/fowards and vi-mode to work with tmux

I'm using bash on Ubuntu 12.04 my inputrc contains: "\e[A": history-search-backward "\e[B": history-search-forward set show-all-if-ambiguous on set completion-ignore-case on"" for my history ...
1
vote
2answers
531 views

Why does echo * | rm -f not work?

Why does echo * | rm -f not work? as per my understanding, echo * should list all the files in the directory and pipe should send this list as an argument to the rm -f command, which should delete the ...
1
vote
1answer
81 views

Show cat output on less exit

After viewing a file in less, with the convenience of scrolling to the side and searching, I want to be able to view/copy the contents of that file normally in my terminal window without having to run ...
0
votes
1answer
30 views

How to know the PBS batch job submit time inside the script being excuted?

I'm using the PBS qsub to run a script on a cluster that must output a report file named with the batch job submit time. The batch job submit time is the time it joins the PBS batch job que. I ...
2
votes
3answers
1k views

Deploying .war file on java application server only when file has finished being uploaded on a linux box

This problem happen quite frequently while uploading a .war or .ear, that are just little more than .zip file, to a remote server, and have it deployed by the application server. Usually, at ...
1
vote
1answer
106 views

Installing java on red hat enterpirse linux 3

I am trying to run eclipse IDE which results in an error which says no java virtual machine was found. The result of running "/usr/sbin/alternatives --config java" command is that it displays - one ...
0
votes
2answers
68 views

Bash - remove all lines beginning with 'P'

I have a text file that's about 300KB in size. I want to remove all lines from this file that begin with the letter "P". This is what I've been using: > cat file.txt | egrep -v P* That isn't ...
0
votes
1answer
496 views

Grep get everything except matching

Lets say I have a text file that says: Hello my name is agz. I am asking a question that is important. If i type: grep -v "is" /path/to/file, I should get no output because both lines have "is". ...
3
votes
2answers
3k views

Efficient way to search string within file find and grep

I am searching all files containing a specific string on a filer (on an old HP-UX workstation). I do not know where the files are located in the file system (there are many directories, with hudge ...
0
votes
1answer
32 views

Find a directory only contained within a certain folder

I have a directory structure like: foo |__bar |__bin | |__tmp | |__bez |__tmp I need to find the tmp directory in bin/tmp, but not the one in bez/tmp. It seems to me ...
19
votes
2answers
552 views

Accidentally sourced .bash_history

In a moment of brilliance, I executed the command source ~/.bash_history. Fortunately, most of the commands are using vim to edit some file, but there are some scary commands in my history - moving ...
4
votes
1answer
101 views

Using su with commands

Ubuntu Server 12.04 On a remote server that I ssh into I have set up a special user with: sudo adduser --system --disabled-login --disabled-password --group suser to run some maintenance functions. ...
0
votes
2answers
65 views

Is there a way to let the user create a cron entry without opening nano

Is there a way to create a cron entry with bash where the user only have to enter the command to execute and the script does the rest. Create cron file if it isn't already created Set the execution ...
4
votes
0answers
205 views

How to disable alternate buffer in GNU screen itself but not for vim, less inside it?

What I would like to accomplish is mouse wheel scrolling behavior that I'm used to in a regular ssh session. In bash prompt mouse wheel should scroll my terminal output, and inside less/vim - the ...
31
votes
3answers
3k views

Have a file named ~ (tilde) in my home-directory

I just noticed that I have a file called ~ in my ~-directory. $ ls -la ~ ... -rw-r----- 1 x1 x1 733962240 Mar 1 17:55 ~ ... Any idea how I can mv or rm it?
0
votes
2answers
1k views

pipe command's output to dialog and allow to scroll up

I want to run an arbitrary command, for example find / -name "a*" I want to pipe its output to to dialog. --tailbox and --progressbox handle this well, except that if the output becomes too much, ...
2
votes
1answer
119 views

Creating a .bashrc function with encapsulated commands

I'm trying to create a function in .bashrc to shortcut my MAMP commands. I want to do something like this: mamp config Opens up MAMP's httpd.conf file for editing. mamp restart Restarts the ...
3
votes
4answers
586 views

Is it possible to use a shell script in the sendto folder?

I would like to use a bash shell script from the SendTo folder. When I put a shortcut to a batch or exe into theSendTo folder it shows up in the shell Send To context submenu, but when the shortcut ...
2
votes
2answers
3k views

How can I make `find` find files in reverse chronological order?

I want to find files in subdirectories sorted by timestamp (of creation), with most recent first. I have looked at the man page but it seems to only seems to let you filter by timestamp rather than ...