Questions tagged [bash]

Bash is the Bourne Again SHell, the successor to the classic Unix sh (shell).

bash is the Bourne Again SHell, the successor to the classic Unix Bourne shell (sh). It's the default shell on many Linux distributions, including RedHat, CentOS, Debian, and Ubuntu.

The premier online guide is the BashGuide.

3527 questions
2
votes
3 answers

Does it break anything if I alias “..” to be “cd ..”?

I find myself wanting to type .. instead of cd .. a lot, so I created an alias for it in one my of my shells. It works as expected, and it doesn't seem to break basic cd and ls usage. Is doing this a bad idea?
Jeremy
  • 123
  • 4
2
votes
2 answers

bash script returns "out of memory" in cron, but not in shell

I'm running a nightly bash script to sync a remote folder (source) with a local folder (target). I've tested this script, based on rsync, and it works fine in a root shell. It takes time since there are hundred of gigs to copy but it works. Once I…
Rosco
  • 455
  • 3
  • 6
2
votes
3 answers

Error while using scp

I use "scp" command in my shell script. How do I get the error log , if that command is not working. This is how I am using it scp file username@servername:/specificdirectory/
yogsma
  • 245
  • 1
  • 3
  • 12
2
votes
3 answers

Get the return value of bat file in Windows in Unix?

I have the following case :- I write a batch file bbb in Windows 2003 and put a return value = 3 by exit /b 3 then I execute this batch file from Unix by this command :- ssh -l admin host 'cmd /c start bbb' but when I print the return value I get…
Mohammad AL-Rawabdeh
  • 1,612
  • 12
  • 33
  • 54
2
votes
1 answer

Nohup linux command waits for an additional return, how do I prevent this?

I'm running the following inside a bash script: nohup java server_program.jar & I want that to start running and go about its merry way. However, for some reason it says that it is ignoring input etc. and waits for an additional return keystroke. …
Travis
  • 141
  • 2
  • 6
2
votes
1 answer

backup email log script spams me: crazed BASH expansion

I have a BASH script that "reads" the backup logs, reports the success/failure of the last backup, lists the contents of the backup directory then emails the results. After moving the backups to a new server and turning the email routine into…
Bubnoff
  • 415
  • 7
  • 18
2
votes
2 answers

Can I do a ctrl-z without the process locking up?

So lets say I'm executing a command on the CLI and it spawns a GUI and I forget the & at the end. Now I want my shell back, so I hit a ctrl-z but the GUI locks up! Is there any way to do a ctrl-z without locking up the GUI? I am using Linux…
Rook
  • 2,655
  • 6
  • 27
  • 35
2
votes
2 answers

How to concatenate environment variable paths in a cleaner way in bash?

In order to modify my paths (like LD_LIBRARY_PATH or PYTHONPATH), I first check is the variable exists. If so, I'm concatenating my old value with the new one (separated with a semicolon), else I'm settings my variable to the new…
Charles
  • 303
  • 1
  • 3
  • 10
2
votes
2 answers

Non-blocking bash redirection

Does anyone know how to redirect the output of a program, running from a bash script, to a named pipe IN NON BLOCKING MODE (having 'O_NONBLOCK' flag set)?
anderson
  • 301
  • 4
  • 7
2
votes
1 answer

Picking a single line from a text file by its line number

In a Unix shell, how can I pick a single line from a text file by its line number? Say I want whatever is at line 3 in animals.txt to be written to stdout (bat bat bat). monkey monkey monkey cat cat cat bat bat bat horse horse horse Is there a…
xyz
  • 501
  • 2
  • 7
  • 13
2
votes
2 answers

Looping through subdirectories

I need to go through subdirectories of a directory /home/userName/ and find the files whose names begin with SY101 and their extension is .csv and transfer those files to another server. My question is how do I loop through subdirectories and keep…
yogsma
  • 245
  • 1
  • 3
  • 12
2
votes
1 answer

How do I redirect console output of command to a logfile?

My OS is RHEL5. I want to direct the console output produced by the following database command to a log/file. psql mydb mydbuser -c "VACUUM ANALYZE VERBOSE" I've tried out the following commands and is not working as expected. But it is printing…
Gnanam
  • 1,459
  • 13
  • 26
  • 32
2
votes
2 answers

What to do if bash scripts come with an incorrect interpreter path?

I'm trying to install BugZilla on our server. The issue is that perl scripts of BugZilla define the path as /usr/bin/perl, and my perl installation is located at /usr/local/bin/perl. I've had this issue while installing other applications as well, i…
gAMBOOKa
  • 999
  • 6
  • 19
  • 34
2
votes
5 answers

System-wide bashrc on FreeBSD

On linux there's usually a global bashrc file (/etc/bash.bashrc or /etc/bashrc). On FreeBSD however bash doesn't seem to support this feature. What's the best way to add a system-wide bashrc then?
Eugene Yarmash
  • 2,433
  • 5
  • 34
  • 54
2
votes
2 answers

How to check what command I used to compile a program?

Possible Duplicate: How to fetch ./configure parameters used at last time? Some time ago under Centos, Bash I've compiled a program from source files. Now I need to compile with again with a new flag. Is there any way to find out what command i…
Tom Smykowski
  • 1,125
  • 5
  • 19
  • 27