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

learn more… | top users | synonyms

4
votes
1answer
994 views

Why does my .bashrc get read when I run noninteractive commands over ssh

I've prepended each of my bash config files (~/.bashrc,~/.bash_profile,~/.profile) with echo NAME_OF_FILE, i.e. I get '.bashrc' when I source in ~/.bashrc. What baffles me is why I get and ...
1
vote
2answers
1k views

Delete empty column from csv file with bash script

Looking for some way to look at a csv file and delete columns including the header that have no values in the subsequent lines that follow. Perhaps if I wanted to delete column Test03 from below ...
1
vote
1answer
932 views

Can't find clogin command for rancid

I'm new to CentOS and setting up Rancid (only used rancid, but new set it up). I've having an issue were I type clogin as my rancid user, however i get command not found ...
1
vote
1answer
41 views

How can I restrict a bash find to only specific sub-sub-directories

I'm trying to list all the files in a specific sub-directory but different directories which are themselves on a different volume. The following works, but only on a fully specific sub-directory (and ...
1
vote
1answer
102 views

Execute dynamic command into all screen sessions

I am working on setting up a minecraft server network in ubuntu server 14.04 LTS. I have several screen sessions each with their own process running in them There are screens on: 2471.LobbyServer ...
1
vote
4answers
1k views

How can I restore my /bin/bash file?

I am facing a problem with my terminal (Ubuntu 12.04 LTS) . I was making some changes in the /bin/bash , but I have kept a backup of bash.rc in case of something went wrong. Anyway today I have tried ...
1
vote
2answers
2k views

Simplest way to verify if a given string is a valid FQDN name?

I need to supply either '-name' or '-sname' when starting an Erlang VM depending on whether the given string is a fully qualified name (FQDN) or not. What would be the quickest and ...
2
votes
2answers
640 views

Bash is losing history even though shopt -s histappend is set

I lost all commands that were executed from the last session - they do not show up in history at all. What needs to be done to prevent this?? I had added shopt -s histappend just for this ...
0
votes
0answers
90 views

Autoexport bash internal variables

I need to access to some bash internal variables (BASH_LINENO, BASH_SOURCE) from a command invoked by a shell script. The only possible interface between my command and the script are environment ...
1
vote
4answers
3k views

I am having trouble trying to authenticate Google SDK using cygwin

I am trying to install SDK using Cygwin as instructed here https://developers.google.com/cloud/sdk/#Quick_Start after Cygwin is installed I follow the guide and then try to authenticate using the ...
1
vote
2answers
323 views

Pipe output from two commands into one

Is it possible in unix/bash to pipe output from two commands into another? I tried running the following command, which successfully ran both commands, but the first was piped to stdout and the ...
2
votes
1answer
883 views

HandbrakeCLI bash batch script not working.

I am trying to batch encode a bunch of files. Looking over the internet I have found just a couple scripts and none of them worked for me. I started to piece together something and it is close to ...
2
votes
1answer
150 views

Can you delete all users but specified accounts in Ubuntu?

I am trying to find a way to quickly delete all user accounts except for the ones I specify in Ubuntu. Is there a good way of doing this? Perhaps a bash script that could do this function? I ...
1
vote
1answer
85 views

How do I negatively pattern match in a bash script file?

If I type rm main!(.tex|.pdf) into a bash terminal, it will delete all files that start with main but do not end in .tex or .pdf, clearing up various junk files that are strewn around by LaTeX ...
0
votes
1answer
356 views

Creating video with multiple audios and one still image for YouTube

I want to create many videos with multiple audio streams and one single picture. For example I have song1.mp3 song2.mp3 song3.mp3 and one single picture. What I need to do is to create many ...
8
votes
2answers
958 views

Why backslash before asterisk in `find`?

In this command: find . -name \*.pyc -delete Why is a backslash needed before *.pyc ?
1
vote
1answer
345 views

Move Files having No Extension

I have 5 files in a directory log.txt abc.pdf def.ppt 1CC 1DD Now I want to Move files having no extension i.e 1CC and 1DD to a another directory i.e tree. whenever i am manually using command it ...
2
votes
1answer
3k views

How to rename the file name with timestamp of created date by JavaScript, Perl or shell on OSX?

Could you tell me how to get timestamp of created date of file and rename the file name with it by JavaScript, Perl or shell on OSX 10.9.2? Example: Existing: Untitled.txt timestamp is 2014/05/03 ...
0
votes
1answer
234 views

Brace expansion seemingly not working in Bash 3.2.51 on Mac OS X

I have a bunch of LaTeX files on my Desktop: ma 512 hw 11.log, ma 512 hw 11.aux, ma 512 hw 11.tex etc. I want to use brace expansion to print them to the Terminal. E.g., ls *.{log, aux} But ...
0
votes
2answers
87 views

Bash: What does echo xy >| foo do?

The kernel mttr documentation gives this command: echo "base=0xf8000000 size=0x400000 type=write-combining" >| /proc/mtrr While I know what > and | do, I have never seen them in combination. ...
1
vote
2answers
64 views

Copy file structure preserving links

I have a directory full of incremental backups (~20GB) which I need to copy (or move) from one partition to another. This directory contains daily snapshots which have been produced using cp -al to ...
2
votes
1answer
631 views

bash: smart autocomplete based on history?

I once found an amazing bash option, but now I can't remember how to re-enable it. It extended autocomplete to look at your most recent history. So if you'd previously typed open index.html and then ...
2
votes
1answer
128 views

Record a process's User/System/Real time in Linux/Bash with greater precision

What I am looking for is something along the lines of /usr/bin/time, however, this usually does not have enough precision. I am running a C program (that I can edit and recompile) and I need to ...
0
votes
3answers
118 views

egrep for time in H:MM:SS format

Working on the file an need to grep the line with a time stamp in the H:MM:SS format. I tried the following egrep '[0-9]\:[0-9]\:[0-9]'. Didn't work for me. What am i doing wrong in regex?
9
votes
2answers
498 views

Cannot concatenate videos ffmpeg

I have a bitmap that I would like to concatenate to the front of many videos as a sort of title screen or disclaimer screen. I try to turn it into a video with the same attributes as the rest of the ...
0
votes
1answer
502 views

Change ConEmu directory to working directory with Git bash

I currently have the following to open a git bash instance: -new_console:"%ProgramFiles%\Git\bin\sh.exe" --login -i The above starts the new tab in the home directory. I'd like it to start in ...
1
vote
1answer
190 views

Find last 24 hours executed commands per each user in bash

How can I find last 24 hours executed commands per each user and mail them the result? I have Ubuntu GNU/Linux. I find out that I need a package named 'acct'. I have already installed and enabled that ...
0
votes
2answers
22 views

Adding logic to 'find' directories containing either [criteria A] or [criteria B]

I have inherited a vast media archive without a unifying organizational scheme. Its contents date back at least 10 years. I have been asked to find a needle in this hay stack, and I have some guesses ...
-1
votes
1answer
36 views

how to write a script that gets 2 files at the commandline reads from the other and writes into the other [closed]

write a bash file that takes two files at the command line and the first file you read from it and write to the next on for example ./file.sh input_file.txt output_file.txt #!/bin/bash read ...
0
votes
0answers
130 views

Bash History Under OS X (Mavericks)

Why does my bash history under OS X never seem to persist for more than an hour or two (or a day, at most)?
2
votes
2answers
110 views

My cursor is at the beginning of my bash prompt. Any ideas why?

I'm using a slightly modified version of Gary Bernhardt's (destroyallsoftware.com) .bashrc with homebrew bash 3.2.51. # . ~/bin/bash_colors.sh . ~/bin/colorize.sh [... snipped ...] # ...
1
vote
2answers
981 views

/usr/bin/env: bad interpreter: Operation not permitted

found some answers here that didn't help me so much ohad@Macintosh-2:/Volumes/develpment/global_constants (master *+)$ node_modules/.bin/mocha -w bash: node_modules/.bin/mocha: /bin/csh: bad ...
1
vote
1answer
335 views

SSH hang at the end of one command

Below command is not coming out : ssh -x -l root asr-bng-ubuntu "/usr/local/sbin/radiusd" But process is getting started when i checked in console. Able to execute same ...
24
votes
8answers
44k views

How to write a script that accepts input from a file or from stdin?

How can one write a script that accept input from either a filename argument or from stdin? for instance, you could use less this way. one can execute less filename and equivalently cat filename | ...
0
votes
2answers
277 views

How to continue running a program in bash

I have made a bash program in Ubuntu. The program is "rock, scissors paper with computer". I want to continue this program until the message "you win, bye bye". Could anyone suggest a method for me ...
0
votes
0answers
168 views

GZIP corruption with big files?

I came across a weird behavior: gzip v1.5 - Fedora r18 A file -rwxrwxrwx. 1 root root 3892576256 Apr 28 11:29 vm.qcow2 Initial checksum: md5sum vm.qow2 954c5461468d68daed3cef6a7b66bd8f vm.qcow2 ...
2
votes
3answers
197 views

Gnu parallel and ack not playing nicely due to stdin, pipe

I'm trying to use parallel and ack together to do some searching in parallel. However, ack seems to insist on using stdin if it finds itself in a pipe, even if you give it files to search: $ echo ...
1
vote
1answer
179 views

Need help in the shell script - gunzip and file command

This is on Ubuntu 12.04. I have a custom webkit based application where "browser" saves bunch of cache files. When triaging the problems, I have to inspect the cache. The cache directory holds many ...
0
votes
0answers
135 views

Specific command not recognized in only one shell

I'm running Windows7 as OS as my development machine. It has various Shells: cmd Powershell Mysysgit GNU Bash <-- this is the one not working PuppetLabs Shell Nodejs Shell PHPStorm built in ...
1
vote
1answer
151 views

Firefox - Download files using external bash script

Is possible to issue external bash script when files are being downloaded in Firefox? My goal is high customization. E.g. scripting something that will save files to specified folder based on ...
1
vote
2answers
61 views

change file name in linux

I have a lot of data with file name. 20110.bil 20111.bil 20112.bil ... 2011150.bil 2011151.bil 2011152.bil The pattern of above file name is: year+(0-152) 0-152 mean August 1 to December 31. I ...
0
votes
1answer
473 views

Stopped process doesn't continue to work after sending SIGCONT

I start cat in terminal: $ cat Then in second terminal I send stop signal: $ kill -SIGSTOP $(pgrep cat) And that works - cat is stopped. Now I want to wake up this cat process by sending ...
2
votes
1answer
171 views

How to source (or run) tail output

I am trying to load serveral variables from a file (not .bash_*) which has similar to: export MY_VAR='foo' The command I was using to "source" this was `tail -1 myFile` This works, but it I echo ...
1
vote
1answer
287 views

Iterating over multiple variables in a for loop

I'm trying to add users to the system from a file. The file looks exactly like this: user@domain.com password 1 user2@domain.com baddpassword 2 The numbers are their IDs. Its coming from a mysql db ...
1
vote
1answer
125 views

bash does not work when cd to a particular directory, read and write permissions denied

Trying to run a Perl's script in Linux Ubuntu 11.10, but when Cd to the path, says : no such file or directory, but i can clearly handle the files inside the path. when trying to change the ...
0
votes
1answer
286 views

how to change directory in ubuntu

I'm trying to change the directories of a symbolic link. ln -s /usr/local/mysql-cluster-gpl-7.1.5-linux-i686-glibc23 /usr/local/mysql When I type command cd /usr/local/mysql it is giving me error ...
0
votes
1answer
87 views

What does ps axuwfw return?

I am getting strange output including my old makefile output and process tree when running below command on linux ps axuwfw Also, what is the usefulness of the following command and how does it ...
6
votes
3answers
5k views

How to execute commands as root in git post-receive hook

I just recently set up a remote git repo on a server for a web app running as an Upstart service. I'd like to use the post-receive hook to trigger actions that are required to update the application ...
0
votes
1answer
870 views

How do I use variables in bash to output to a file and to a mail body with sendmail

I've been working on this little script and it's nearly at a point that I can start using it. The idea is to automate WordPress installs via Plesk. I've got Plesk setup with a cronjob to download ...
0
votes
2answers
924 views

How to rotate enumerated filenames similar to logrotate?

I have a couple of files, let's say map-0.jpg (newest), map-1.jpg, map-2.jpg, ..., map-9.jpg (oldest). Now my cronjob downloads a new picture from the internet and should save it as map-0.jpg. All ...