The Bourne-Again SHell (Bash) is a successor to the Bourne shell (sh). Bash is the default shell in many Linux distributions.
3
votes
3answers
25 views
bash don't delete subfolders with specific files in recursive rm -rf /folder/*
I wonder if it is possible to specify some elegant condition (parameter maybe?) in rm -rf /folder/* not to delete its subfolders, which contain files with name "dontshoot.txt".
I wasn't able to ...
0
votes
0answers
3 views
rdiff-backup errors: script keeps quitting with error
Ive recently been introduced to bash scripting... So, Ive used my advanced theft course to throw together the attached script. it runs... and exits with "/xxx/ not mounted. You are not root! I have ...
3
votes
1answer
36 views
How to call a bash script automatically when a directory containts chage
My goal is to run a bash script automatically whenever any new file added to a particular directory or any subdirectory of that particular directory.
Detail Scenario:
I am creating an automated ...
0
votes
0answers
12 views
If fails or copy function fails?
I have a little bash script where I compare two files. If one doesn't exist and second one exists, then I will copy/replace backup to main folder.
Somehow this doesn't seem to work. Hope someone can ...
0
votes
0answers
11 views
Running script on a remote server in bash working on 1 server, not on the other
When I am running this script on 2 servers in hostnames, it succeeds on one of them, but not on the other.
The log output is pretty ugly, so I won't post all of it. Here is part of the bash_history, ...
0
votes
4answers
18 views
Moving the second column to first column using awk
I would like do the following using awk:
Example of my input data with four columns and a number of rows:
10 20 30 40
50 30 60 80
90 12 40 20
Desired output:
10 20
30 40
>
50 30
60 80
>
...
0
votes
4answers
25 views
Script complains about `sed: option requires an argument — e` and `No such file or directory`
In my script, I am taking a text file and going through the file line by line and replacing the string "test" with "true", then redirect it to a new file. Here's my code:
cat $FILENAME | while read ...
1
vote
2answers
37 views
what wrong with my regular expression
I have a simple regular expression, and testing egrep on hexadecimal numbers
regex="^([0-9A-Fa-f]{2})(:[0-9A-Fa-f]{2})*$"
when i try to echo any Input it's just print Nothing
echo "fe:fe" | egrep ...
0
votes
2answers
20 views
What is the difference between variable post-increment/decrement and pre-increment/decrement in bash?
ARITHMETIC EVALUATION section in bash manual lists following operators among others:
id++ id--
variable post-increment and post-decrement
++id --id
variable pre-increment ...
3
votes
4answers
38 views
sed: insert a macro with backslashes and newlines before a line in a file
I have text in a file like:
#include<stdio.h>
#include<stdlib.h>
#define MIN 0
#define MAX 100
I want to insert a macro before the 1st #define like:
#include<stdio.h>
...
0
votes
0answers
10 views
Change terminal tab name dynamically in mac
Is it possible to change tab name dynamically in mac terminal?
Default appearance "bash" changes to "user@server" when I use ssh.
Like this behavior I want to change tab name according current ...
0
votes
0answers
8 views
How can I pass symbolic linked file path parameter to Wine programs from a bash script?
I made a very short bash script which start Virtualdub with Wine, and it can get a parameter too, the name and path of a video file. My script, called "vd" (it is placed in /usr/local/bin and chmodded ...
1
vote
1answer
26 views
Why does power of two >62 in bash output negative values or zero?
If I use a larger integer than 62 for power of two in bash(4.0.33(0)-release), then following happens:
$ time echo $((2**60))
1152921504606846976
real 0m0.000s
user 0m0.000s
sys 0m0.000s
$ ...
0
votes
1answer
25 views
How do I use pbcopy in a bash function? Can it be scripted?
I often find myself copying history commands to my clipboard using this:
echo !123 | pbcopy
This works fine from the Terminal. Assuming !123 = cd .., it looks something like this:
$ echo !123 | ...
0
votes
0answers
9 views
easy_install using older module for dependency check [migrated]
How do I get easy_install to see a newer version of a module which is required to install another module?
I'm trying to install MISO locally using:
easy_install --user -U misopy
It gives me an ...