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

learn more… | top users | synonyms

0
votes
2answers
31 views

Setting java path in bashrc and cshrc

My system java's version is 1.6, for running Eclipse I need jre 1.7. I've already downloaded and unpacked the archive of java 1.7, but I cant change the default path from /usr/bin/java to my unpacked ...
0
votes
1answer
35 views

Bash hints does not work after sudo or man

I use Centos 6.5. Tab key on keyboard helps to insert command in terminal. E.g. if I write vi and press tab then all possible opportunities are printed: $ vi vi vim ...
0
votes
1answer
30 views

Linux bash iterating and Break

I have two server groups SERVERS_CA AND SERVERS_NY. I will have a array something like SERVERGROUP=(CA NY) CA and NY will have set of servers in arrays like CA=(ca126 ca546 ca 642) NY=(ny112 ny113 ...
0
votes
1answer
33 views

How do I make sure that bash (not tcsh) is used in Linux?

I have a bash script where I use ssh to connect to another server and run some commands there. I found some sites that the error (Warning: no access to tty (Bad file descriptor). Thus no job control ...
2
votes
1answer
22 views

“Delete word forward” in bash

I know that in bash, alt-backspae does what ctrl-backspace does in modern GUIs: It deletes a word backwards. I'm looking for the equivalent of ctrl-delete, i.e. delete a word forward. I tried ...
1
vote
1answer
22 views

What's the soonest I can send a signal to a background process (trap)?

I have a script from which I run a second script in a subshell. What's the soonest that can send a signal to the second script? script1: ./script2 & kill -SIGCONT $! script2: echo "~~ ENTRY" ...
1
vote
1answer
30 views

Shell, subshell, source, background process, PID == confusion

I am trying to get my mind straight as to how all these things are put together. For example with this script: #!/bin/bash . script1 ./script2 . script3 & ./script4 & sleep 5 How do the ...
0
votes
1answer
51 views

What is the meaning of this message in bash commandline?

I did gnome-open document.pdf on my bash shell and I getting this following message :- " ** (evince:11832): WARNING **: Error setting file metadata: No such file or directory" What is ...
0
votes
2answers
73 views

How to batch rename files on Ubuntu?

I found rename on Ubuntu 10 doesn't support regex unfortunately. I need to rename files containing _thumb to _t leaving the rest as is. Example: rename SLN0097H_thumb@2x~ipad.JPG to ...
1
vote
1answer
23 views

Is is possible to insert comments into a long command with escaped newlines?

I have a long command line, longer than but similar to the example below. I would like to add comments to individual argument in the sense of what is shown here: ssh -N \ -R :10000:10.0.0.1:80 \ ...
0
votes
1answer
46 views

How do I build a script shell to send cmd via telnet and log only results?

I would like to make a shell script that can call a range of IPs via telnet, to send a command, and write the result to a file.
0
votes
2answers
40 views

Move a range of files

I have a range of numbered files (images) and I want to move them to subdirectory. https://superuser.com/questions/380338/move-a-range-of-numbered-files#= suggests that I use mv IMG_{001-022}.jpg ...
-1
votes
1answer
73 views

Syntax error: “(” unexpected in bash script

The script is for adding torrent files to a folder and having them added to transmission. Here's the script: #!/bin/bash for file in /home/me/box/*/* do dir=$(basename $(dirname "$file")); sudo chmod ...
0
votes
2answers
77 views

any way to run grep backwards, i.e. from the end of the file and up?

i have a 70G+ log file, and i'd like the most recent entries (apache log append new items at the end) that match a pattern. i can either: run grep | tail or run tail | grep option 1 will take ...
1
vote
1answer
19 views

Prevent bash re-inclusion

I have a nest of bash scripts that can source each other, e.g. a.sh sources b.sh sources a.sh etc... Other than redesigning, which may not always be feasible, what are the best practices for avoiding ...
1
vote
2answers
30 views

Make a web request, cat response to stdout?

I'm working from the command line. I need to cat the response of a web request. What tool can I use to make the web request and print the response on stdout? Here's the command I'm trying to make ...
3
votes
1answer
63 views

Bash: optionally passing arguments to a command

I'm trying to add arguments to a command call depend on another variable. Please look at the shell scripting code: curl \ $([ -z "${title}" ] || echo --data-urlencode title=${title}) \ ...
1
vote
0answers
52 views

Why isn't “(ulimit -d 1000; firefox) &” working?

I'm trying to limit the memory usage of firefox to prevent it from stalling the whole system with problematic web sites. I tried, in bash: (ulimit -d 1000; firefox) & This should limit the ...
1
vote
1answer
15 views

pwgen: no numbers when outputting into file

I just tried to output hundreds of passwords to print them out when I noticed that no one actually has numbers in it. This is what I entered: $ pwgen -B -N 10000 15 > pw.txt But when I execute ...
1
vote
3answers
91 views

Parsing the output of “uptime” with bash

I would like to save the output of the uptime command into a csv file in a Bash script. Since the uptime command has different output formats based on the time since the last reboot I came up with a ...
0
votes
0answers
85 views

shell script over SSH ends unexpectedly after running 'ant build'

I wrote a shell script that runs on remote host to build source code with 'ant build' command, and then distribute the built binary to other servers. However, right after Ant build is over ...
3
votes
2answers
83 views

In bash, how I define a “command scope” variable?

I'm reading this book on the bash architecture and one of the bash maintainers says: There are different variable scopes for shell function calls and temporary scopes for variables set by ...
0
votes
1answer
20 views

Open gnome terminals programmatically with a script that requires a doublequote

I am trying to use a wrapper.sh script spawn separate terminals for a script that takes params in doublequotes, like so: #!/bin/bash gnome-terminal -e "./script.py -d "somevalueforscriptpy" $1" ...
-1
votes
1answer
22 views

How to collect specific data? [closed]

I have a text file like this abcdxxxxx abcdxxxxx 1234567 - abcxxxx from that file I want to separate only the strings with abcd as header part. Help me please. Thank you.
0
votes
2answers
43 views

Is there any reason this cronjob would fail in cron, but not on the command line?

I have written a little one liner that will email me when a list of files changes - I used sha512 to generate a list of hashes and then periodically check that those hashes still match. */5 * * ...
0
votes
1answer
25 views

Weird output in my mac iTerm bash shell. How do I make it clean?

Setting up my bash and made some mistake. Here is my bash shell: android-c26f663baae722eb:~ okyretina$ I have used a clean .bash_profile and sourced it and the shell still have that weird ...
1
vote
1answer
64 views

How to give each virtual terminal in GNU Screen it's own background color?

I have a dream: I want each virtual terminal within GNU Screen to have it's own unique background color. I think I can fake it in an .bashrc script that emits xterm control codes to set background ...
1
vote
4answers
105 views

Avoiding users to corrupt and use a script

Is it possible to deny the right to copy files? I have a script which should be executable by others. They are also allowed to read the file (though it would not be a problem to forbid reading). But ...
0
votes
0answers
118 views

Raspberry in kiosk mode - How to secure bash or change matchbox for switching tty

I want change my raspberry to a kiosk pc. It works well and is complete, but with some mechanics I've some trouble. The actual problem is, that the autologin mechanism is defeating the purpose of ...
0
votes
0answers
60 views

Automaticly run xinit from rc.local as different user

I'm working on some tuning of my raspberry pi b+. So I decided that midori should start automaticly after autologin. With startx it works without problems, but X is still to ressource hungry. So I'll ...
0
votes
1answer
30 views

How to print index in a 'for-loop' being executed in remote host through SSH?

I want to ssh into a remote host, and then execute a for loop that goes through sequence of numbers to control number of different nodes. ssh user@host /bin/bash << EOF for i in {1..10} do echo ...
2
votes
2answers
65 views

How do I delete all lines but the last one using unix ed editor from a bash script

I have the following bash file called "file" (the real one does something useful): ed db/seeds.rb <<EOF 1,$-1d a 123 456 . w q EOF When I run "bash file" it doesn't delete any lines. If I use ...
2
votes
3answers
67 views

Why is this sudo command try to run in /root?

I try to run a sudo command via SSH like this: ssh domain.com sudo -u user bash -c "cd /home/user/ && ls" (which is obiously just an example). I get back: /home/user/: line 0: cd: /root: ...
0
votes
1answer
29 views

Is \d equal to [0-9] in sed?

7 00:00:30,008 --> 00:00:30,066 by line 8 00:00:31,038 --> 00:00:34,050 or later in the nineteen seventies it was usually a 9 00:00:34,005 --> 00:00:38,634^M video consul but the council was ...
0
votes
1answer
53 views

Enter response once prompt returns?

It's neither a secure idea nor one I'd recommend elsewhere, but I have a situation when occasionally it takes a while for my Ansible ad-hoc command to respond. I'd love to pipe or args or whatever is ...
0
votes
1answer
72 views

bash doesn't show current working directory on screen

When using iTerm2 on my OS X, the bash prompt shows my current working directory normally: mbp:tp0 renato$ But when I use screen, the bash prompt changes to: bash-3.2$ How I make the bash prompt ...
0
votes
1answer
31 views

Why doesn't the binary package get reinstalled by apt-get or building from source?

I'm trying to install Asterisk on my Debian wheezy server. For this I first did the simple sudo apt-get install asterisk This worked flawlessly. Afterwards asterisk was running and I could enter ...
0
votes
1answer
30 views

ssh to production to www-data user

I build an automation for deploys, that we connect to our productions servers and then perform a git pull in the project. The project is owned by "www-data" so I need to to --> ssh ...
2
votes
2answers
36 views

How to check if a directory is under svn version control?

From a linux bash script, how can I verify if some directory is under svn version control? I am using svn version 1.7.9. When I try the following pushd ${WD}; svn info; popd and check the error ...
0
votes
1answer
47 views

Alias to connect to AWS instance via SSH not working

I made an alias to make it easier to connect to my AWS EC2 instance. Although there is an error. Here is the code in ~/.bash_profile: alias aws_connect=‘ssh -i /path/to/keyfile.pem ...
0
votes
1answer
26 views

How to get when run `top` command ports listed?

How to get when run top command ports listed ? I get info about process but I need port to see ( process dies very quickly , 0 seconds, and I cannot grep after ps aux ). Is possible to top command ...
0
votes
2answers
41 views

Files listed by bash but unaccessible

What would cause the following behavior on an Ubuntu 12.04 system? I've SSHed into a machine as the "ubuntu" user. Running ls -lah /data/* shows dozens of non-empty files (e.g. file1.txt, file2.txt, ...
-1
votes
1answer
76 views

How to use HTML markup tags inside Bash script

I have crontab and a simple bash script that sends me emails every often containing PHP, NGINX, MYSQL errors from their log files. This is a simplified example. #/home/user/status.sh ...
1
vote
2answers
27 views

two processes are listed for one shellscript?

I have a shell script which does somewhat simple. #!/bin/sh do something boring... When I execute the shell script like this, $ nohup sh mysh.sh > /null/dev/ 2>&1 & I see there are ...
0
votes
0answers
21 views

How to clean up output from `watch git gc`?

git gc updates the output as it runs, perhaps using backspaces, control characters, and/or curses. (I'm not an expert on this.) How can I modify my watch -n 60 git gc bash command so that the output ...
0
votes
1answer
40 views

How to pass output of command to sed

My sed command in #Update key in config file. does not get the contents of the variable $GETKEY Someone help me? # Get key from output of the website. GETKEY=`wget https://www.badips.com/get/key ...
0
votes
0answers
30 views

busybox cp 'are the same file' when copying directories

I'm porting a bash script that worked on OS X to Windows+BusyBox. The first command is to create a new directory mkdir ../new_directory Then to copy all files from the current directory to a new ...
0
votes
0answers
22 views

Check for available command

When I execute the bash script with root user I receive the output it say iptables not exist. Why this happens only with root? for CMDAPP in "hash" "curl" "iptables" do if ! hash "$CMDAPP" ...
0
votes
0answers
29 views

Desktop Gone in Centos 6

I had a third party library created a ~ folder (a bug there), and I tried to delete it by "rm -rf ~". And apparently, it is a mistake -- my session got rebooted and then when I went back in, all the ...
0
votes
1answer
87 views

Drush commands not found when called from a bash script

Relevant system background: I'm using MAMP on OSX. Output of which php is /Applications/MAMP/bin/php/php5.3.14/bin/php Output of which drush is /Applications/MAMP/bin/php/php5.3.14/bin/drush Output ...