Tagged Questions
13
votes
8answers
3k views
Object-oriented shell for *nix
Preface: I love bash and have no intention of starting any sort of argument or holy-war, and hopefully this is not an extremely naive question.
This question is somewhat related to this post on ...
1
vote
2answers
44 views
Direct recursive shell script output to each subdirectory, not parent directory
I'm processing a batch of subjects data recursively, calling the script within the parent directory.
For example, I have the parent directory:
/home/subjects
and the subdirectories which contain ...
-1
votes
0answers
46 views
shell scripts in linux [closed]
The "time and network" script
•Find the current time.
•If the current minute-of-the-hour is greater than 30, then use ifup to enable all network interfaces, otherwise disable all network interfaces ...
4
votes
3answers
70 views
CD into directory from HISTORY in a bash script or alias e.g. $(!!)
I often want to change into the directory of a file on my file system, but I'm not sure where the file is.
I search for it like so:
find -type f -name "myfile.txt"
Lets say for the sake of ...
2
votes
1answer
37 views
Invoking a script with ld-linux.so?
I just downloaded a tar file that is supposed to include everything required to run a program that we can call some_binary. I extracted it's contents, and I see the following:
A binary (let's call ...
1
vote
3answers
316 views
Evalute passed in variable in bash
Is there a way to pass in a variable as an argument to a bash script and have it evaluated scoped by the bash script?
Given:
# cat /path/to/file/of/host/names
bob
tom
joe
etc...
# dofor
FILE=$1
...
2
votes
4answers
113 views
store and execute redirection/piped command in script
How do you store, and later execute, a command with redirection and and a pipe? (And is it the pipe, or the redirection, or both, that's causing my problem?)
I tried to print the urxvt version in a ...
3
votes
1answer
119 views
Increase %e precision with /usr/bin/time shell command
When I run the time command in shell time ./myapp I get an output like the following:
real 0m0.668s
user 0m0.112s
sys 0m0.028s
However,when I run the command \time -f %e ./myapp I lose ...
5
votes
3answers
3k views
Processing bash variable with sed
Been banging my head off a wall on this
bash variable LATLNG contains a latitude & longitude value in brackets like so
(53.3096,-6.28396)
I want to parse these into a variable called LAT and ...
4
votes
4answers
197 views
List any file ending with .in and corresponding .out with shell script
I have a directory full of files ending with different extensions, how would I list/select only the files ending with .in and corresponding .out that share the same basename?
e.g.
file1.txt
file1.in
...
1
vote
1answer
121 views
How to match 2 large file and print the difference in shell script
I have 2 files.
File1 has 400k numerical records.
e.g:
1
2
3
4
5
6
.. and so on
File 2 also has 420k numerical records.
e.g:
1
2
3
4
6
.. and so on
Both these file are in unsorted manner. I want ...
31
votes
5answers
16k views
Allow setuid on shell scripts
The setuid permission bit tells Linux to run a program with the effective user id of the owner instead of the executor:
> cat setuid-test.c
#include <stdio.h>
#include <unistd.h>
int ...
1
vote
2answers
298 views
How to correctly concatenate strings in shells script?
I have a bash shell which I need to modify, and I have to set a variable in a script and then call another script. My variable, EXTRA_JAVA_OPTIONS must be
-javaagent:myagent.jar="-d 0 -i 1000 -l log2 ...
1
vote
3answers
100 views
Rerunning the same command with a different parameter
I know that I can run the following command
ls Some{File,Folder}
And it is equivalent to running this:
ls SomeFile SomeFolder
(I also use it a lot for things like mv place_{a,b})
However, I was ...
2
votes
2answers
256 views
Check whether files in a file list exist in a certain directory
The runtime arguments are as follows: $1 is the path to the file containing the list of files
$2 is the path to the directory containing the files
What I want to do is check that each file listed in ...