0
votes
1answer
21 views

Script not working when run automatically

This script (parts of it) runs perfectly when invoked manually from the Terminal: #!/bin/bash [[ "`ps -e | grep -c $(basename $0)`" -gt "2" ]] && echo -e "`basename $0`: Mutiple instances ...
0
votes
1answer
18 views

Renaming files in a folder (and subfolders) by removing a token in filename

I have a huge amount of files in a folder (and subfolders) that I need to rename. For example, I have: movie1.mp4 fixed_movie1.mp4 ... What I need is to rename fixed_movie1.mp4 to movie1.mp4 ...
0
votes
0answers
26 views

Combining a bunch of find commands into one command or script.

I was wondering how to combine a bunch of find commands into one. This is the list of find commands I want to run and in the order. find /path/to/folder/ -name '*Sample*' -exec rm -rf {} \; find ...
1
vote
1answer
34 views

bin/bash script: toggle bluetooth state?

I'm trying to do an alfred workflow that toggles my bluetooth connection. STATUS=$(/usr/local/bin/blueutil status) if [ $STATUS == "on" ] then /usr/local/bin/blueutil off echo "off" else ...
0
votes
1answer
93 views

Simple bash gpg update script

I have a text file in which I save all my important personal data like all my accounts' passwords and my credit cards' PINs in case I forget those. Obviously, that file needs to be encrypted, so I ...
2
votes
1answer
64 views

How to properly restore settings when running a script using “source”?

I'm writing a script that needs to be executed using source, because its task is to modify the environment. During the script, I want to use set -e so that any error stops the script. The script looks ...
3
votes
3answers
68 views

merge pieces of file together

I have a directory tree of files I need to loop through and reformat the lines. can I do this with sed with some combination of find? for each file, I'll need to adjust the text in the file from ...
1
vote
2answers
232 views

Revising a bash script - Invoking a change of prompt color via a temporary file

I am wondering why the following script won't work: #!/bin/bash read -p 'First lets write PROMPT.SH' echo '#!/bin/bash'>prompt.sh echo "export PS1='\e[1;31m\]\u@\h \W\$\e[0m\] '">>prompt.sh ...
0
votes
1answer
2k views

Expect script inside bash script optional statement

Using: CentOS 6.2 BASH shell My script is something along the lines of #!/bin/bash INSTALL_PATH="Enter install path" CR="\n" /bin/su root -c "/usr/bin/expect << EOF spawn name.run expect ...
0
votes
2answers
60 views

Has Anyone Made a Program to Manage Scripts (Non-CM)? Recommendations?

I find myself often writing shell scripts in Linux and losing track of them over time. What I would love is a program that stores a copy of the script, along with a descriptive note I write at the ...
1
vote
1answer
895 views

Shell script to rename multiple files from their parent folders name

I have a file structure like this: 00000010 000000001.file1 000000001.file2 00000020 00000003.file1 00000003.file2 00000003.file3 ... So there are folders with 8-digit names containing one ...