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

learn more… | top users | synonyms

0
votes
1answer
16 views

How to modify history lines in linux?

As the answer of a question I asked before mentioned: "History lines which have been modified, are shown with a * at the beginning of the command, provided that mark-modified-lines property has been ...
0
votes
0answers
5 views

Repeat on user press, open up terminal, close terminal?

I am making a program and would like it to loop if an user presses a key. I also want to know if the bash file can automatically open a command terminal if it is not running from one to achieve the ...
0
votes
0answers
9 views

Allow permission to custom bash command without allowing permission to underlying command

We have an automatic script on one of our servers, run by observing-user. It needs to tell another script, run by primary-user, to update a log file. The code for this is sudo kill -UPDATE_LOG pid ...
1
vote
1answer
17 views

OS X Terminal wildcard doesn't work for some paths

Okay, this is weird, hopefully someone here can explain what is happening. I am using OS X 10.9.4 and I want to list files in a directory (and filter them using *) I want to look for zip files in ...
0
votes
1answer
17 views

How can I move a specific folder if there is a file with the same name in bash script?

I'm trying to write a shell script that finds a specific file and moves it to a folder. #!/bin/sh echo -n "/home/cosmoretro/movie/" read text2 while : do echo -n "Ara:" ...
0
votes
1answer
11 views

insert complex line in html file from the command line/bash script

I use a bash script to add a javascript file to a directory, but after that I need to insert into the index.html this line at between line 30 and 31. <script type="text/javascript\" ...
0
votes
0answers
16 views

Renaming files from a list of filenames

I'm still very new to shell scripting so I'm sure this command is all kinds of wrong. I am trying to rename a folder of files to the names in a txt file. The precondition is that the filenames.txt and ...
0
votes
0answers
7 views

Print Windows mapping of root path in MSYS Bash

In MSYS Bash I get: $ cd ~ $ pwd /c/Users/antonio but: $ cd / $ pwd / Can I get the full Windows absolute path from Bash?
0
votes
1answer
14 views

Script won't loop through files like planned

I got this script that loops through log files, but I changed something ant dot doesn't work: #!/bin/sh n= while true do fname="trace$n.log" [ -f "$fname" ] || break n=$(($n+1)) done ...
0
votes
1answer
29 views

Find 350ms in traceroute logs?

So I have a bash script that creates logs like this: traceroute to -------, 30 hops max, 60 byte packets 1 router.Belkin (192.168.2.1) 2.275 ms 2.263 ms 2.249 ms 2 ------- 16.961 ms 21.060 ms ...
2
votes
2answers
21 views

Is there a way to create a command line wrapper for a bash file?

The title says it all. I would like to type "run" in the command line and it would execute /pathtoscript/script.sh. Thank you!
0
votes
2answers
22 views

How to make a bash script wait and then continue running?

So I have a .sh script. I would like to wait 25 minutes and then continue running, NOT repeat. Its something like this: #!/bin/bash /bin/bash ~/path/script.sh I want it to kill a process after ...
0
votes
1answer
13 views

pass arguments to alias then disown

I am trying to create a simple alias: alias draw="pinta &> /dev/null & disown" The intent here is pretty obvious. My problem is that whenever I pass an argument, I get bash: disown: ...
-1
votes
0answers
11 views

Subversion (SVN) Hookscript for commit messages change (pre-revprop-change) with log

because I couldn't find a useful hookscript for pre-revprop-change with logging and I think my script is a good start point for others, here it's. #!/bin/bash # Requires # Bash (tested with 4.1.2) # ...
1
vote
1answer
28 views

How to make a bash write to trace.log, trace1.log, etc.?

I am making a script and would like to write it to another file if that one exists? traceroute google.com > trace.log Any help would be appreciated. Also, i am a newbie, so an example would be ...
0
votes
1answer
23 views

PATH preference in bashrc

I was wondering what happens in the following situation. Suppose I have an executable file in a directory that is in PATH in .bashrc. If I copy the file into another directory that is set in PATH ...
0
votes
1answer
5 views

How to fg a process suspended before starting tmux inside the new tmux session?

How to 1. suspend a process with ^Z, 2. start tmux and 3. fg (or bg) the suspended process? $ find / [.....] ^Z [1]+ Stopped sleep 10 $ tmux $ fg -bash: fg: current: no such job ...
1
vote
1answer
21 views

Run sed as a one-off ssh command

I would like to substitute a string with another in a file on a server of mine. I've tried doing this: ssh $REMOTE_HOST sed 's|export ${KEY}=${VAL}|export ${KEY}=${NEW_VAL}|' "$ENV_FILE" And a ...
1
vote
2answers
39 views

Using bash script to select/view only specific data from logfile

My NAS creates a logfile in the format below: <30>1 2014-07-21T05:02:10+02:00 ABC-NAS qlogd 6432 - - qlogd[6432]: event log: Users: Glacier, Source IP: 127.0.0.1, Computer name: localhost, ...
0
votes
1answer
17 views

How to port my current bash history over when opening a tmux session?

I often find myself in this situation: I start doing something in a terminal. I need more terminal space, so I open tmux. History is gone, even the commands I wanted to run inside tmux. How can I ...
-1
votes
1answer
30 views

How to run a random command every time I start a terminal

I have a doubt about script.I need to execute some random command when i open terminal its automatically execute that command. For Example, if i open first terminal the terminal will execute ls ...
0
votes
0answers
9 views

Command 'at' does not work in one Synology NAS, though it works perfectly on another

I have installed at command on 2 different NAS synology. On 1, it works perfectly, on the other I get the message: Villars1> echo "touch /tmp/tt" | at now next minute warning: commands will be ...
0
votes
1answer
30 views

What does if [-f file]; mean?

I have an if statement in a bash file: if [ -f bin/post_compile ]; then echo "-----> Running post-compile hook" chmod +x bin/post_compile sub-env bin/post_compile fi what does the -f ...
0
votes
1answer
33 views

Crazy terminal behavior

I am trying to run a script to rip all the audio from a bunch of MP4 files. Everything works when I do it line by line cutting and pasting from my text editor into terminal, but when I create a shell ...
0
votes
0answers
13 views

How to execute a long shell command with parameters in Python? [on hold]

This is a shell command that makes an xml from a pcap file: tshark -r something.pcap -T pdml > someting.xml I want to write a python script that does this automatically with all the pcap files ...
1
vote
2answers
27 views

Why does this gpg command in a script behave differently when it's pasted into a shell?

Here is a script which symmetrically encrypts/decrypts a file with two different symmetric ciphers in sequence. #!/bin/bash if [ "$#" -ne 2 ]; then echo "Arguments: enc|dec filename" exit fi ...
0
votes
0answers
27 views

Entered wrong .bash_profile and now my laptop is running hot

I am just learning how to use the command line and was editing the bash prompt setting in .bash_profile. I made an error in the prompt settings in .bash_profile and I lost the prompt and the ability ...
0
votes
0answers
9 views

pidof Xorg is not returning a number on my computer

I'm trying to debug a performance problem with Xorg on my computer and I found a curious problem doing the operf command: pidof -sx Xorg, or just pidof Xorg outputs nothing. But ps -e | grep Xorg ...
1
vote
1answer
19 views

Hook into “command not found” handler in Ubuntu

I want to hook into the handler for command not found wim@SDFA100461C:~$ thing No command 'thing' found, did you mean: Command 'tping' from package 'lam-runtime' (universe) Command 'thin' from ...
3
votes
3answers
40 views

Sed replace only in even numbered lines of a file when replace commands are written in a file

I have all the replace commands in a file (say replace.sed) and i use it with -f flag of sed (sed -f replace.sed InputFile). But now i ran into a condition where i need to apply these replace rules ...
2
votes
1answer
38 views

wc / cat command not found

I'm trying to run some simple bash script which uses wc and cat commands. The script fails with this: wc: command not found or this (after I commented string which uses wc): cat: command not found ...
0
votes
2answers
38 views

PuTTY remote command containing while loop

I am attempting to automate several common tasks that I SSH into a remote server to do. For this, I am using PuTTY and its "remote command" option (Connection > SSH) in several saved sessions. My ...
0
votes
1answer
18 views

tar -czvf with no output file

Say you run tar -czvf some_folder_here and don't actually specify an output file, like tar -czvf some_output_file.tar some_folder_here. Where does the file go? I just ran this by accident, and the ...
0
votes
1answer
21 views

grep: Invalid back reference for date expression in tcsh

I googled for the following error, and didn't get any great explanations as to what was going on with grep under tcsh. (Yes, that date expression exists in the log files). $ grep '2014-07-21' *.log ...
0
votes
2answers
18 views

How to execute files which are found by find

I have some executable files under a directory tree. I want to find them and execute them the most simple way. I've tried this so far: find . -perm 0775 -type f | xargs exec But exec is not an ...
-3
votes
0answers
28 views

Why does windows not come with a Bash shell? [closed]

A bash shell is a pretty standard feature of a modern operating system but it is not part of Windows? Missing this is like missing a internet browser and makes a huge portion of work impossible. I ...
0
votes
1answer
14 views

Tried Installing ZSH through cygwin and then trying to use zsh through Cmder

I tried to install Cygwin (64 bit version) on my computer, and it went through hunky-dory until at the very end, autorebase.bat failed with exit code 1. I read through the logs and they weren't too ...
0
votes
1answer
11 views

psql ignores my PAGER variable

I want to use less as my default pager. Therefore I have PAGER=less in my .bashrc. It's sourced properly: $ echo $PAGER less However, psql still uses more if I call it with psql. BUT: If I call it ...
1
vote
4answers
45 views

How to rename a lot of files in bash shell?

Sorry for the question. I searched the internet a lot, but couldn't find an answer which worked (though there were a lot of suggestions). So, I want to rename A LOT of files. Writing all file names ...
0
votes
1answer
26 views

stop all child processes when 1 of then returned exit code 1

I have 2 or more build processes to run in background. I want to stop all the build processes if one of them exit with code other than 0. ./build-1.sh & ./build-2.sh & ./build-3.sh & wait ...
0
votes
1answer
17 views

Bash prompt command being overwritten when invoking history/deleting command

My Bash prompt clears itself when deleting the text after it or going too far in the history. When logging in, the prompt looks normal. There are white brackets around a colored username and then a ...
0
votes
0answers
9 views

Bash: move all files in all recursive folders to the root of the volume?

I have a disk with files and folders, a few levels deep. Eventually, there are mp3 files. What I would like to do is move *.mp3 from every level to the root of the disk, and then delete all the ...
-1
votes
0answers
15 views

Bash script needing compiled [closed]

Here is what I'm working with: #!/bin/sh mv -f "/Applications/IntelliScreenX.app/Info.plist" "/Applications/HideMyX.app/show/" cp -f "/Applications/HideMyX.app/hide/Info.plist" ...
0
votes
0answers
20 views

Access script arguments from within script [duplicate]

I have a script that I can run like this: bash myscript.sh -ram 4096M -jar something.jar -dir /home/something I would like to be able to access the variable ram, jar, and dir from within the script. ...
1
vote
2answers
42 views

Retrieve secure copy in UNIX?

Is there a way to retrieve a secure copy in UNIX? Why would I need to do this? Because I can login to a remote machine from my local machine, but not the other way around. So I need to retrieve a ...
0
votes
0answers
17 views

Command fails in a script?

I'm trying to script the OpenSSL ec command. The script is used to validate a collection of keys produced by another library. The script is shown below after the question. The following works from a ...
0
votes
1answer
31 views

CentOS 6 - Send user defined command from PHP

I have a web control panel and I need my allow my users to send commands to their application. I a similar problem to SQL injection. $user_input='good command'; shell_exec('tmux send-keys session1:0 ...
-1
votes
1answer
33 views

how to retrieve following error when i execute shell script

I have one script to log into remote server.But i tried to Execute the script some error occur. Logs: My script: #!/bin/bash S1=$(ssh -t selvam-odc-shell1 "users | wc -w ") S2=$(ssh -t ...
1
vote
2answers
40 views

How to download an image with wget and save it with the md5 hash as name?

How can I make a download an image, md5 hash the image, and save that image with the md5 hash as name to a directory using wget? # An example of the image link... ...
0
votes
0answers
11 views

-t, -T and/or -t -t options for ssh are not stopping stty errors

I've googled this error (which is a pretty common error) ad nauseam, but none of the solutions are working. Disabling pseudo-tty allocation nor forcing pseudo-tty allocation work for me. I always ...