|
Help me with this this problem. so far i have "find / -perm -4000 -o -perm -2000 | xargs ls -l > suild.list" argument that i want to write as a bash script.
I would like to write this as a bash script and be be able to run this nightly everyday. But...
Started by su on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at serverfault):
#!/bin/bash find / -perm -4000 -o -perm -2000 -ls > suild.list....
Just use -ls with find .
You would need to add a header:
#!/usr/bin/env bash
And you xargs in this case.
Your command is already a bash script.
|
|
I have a Cygwin bash script that I need to watch and terminate under certain conditions - specifically, after a certain file has been created. I'm having difficulty figuring out how exactly to terminate the script with the same level of completeness that...
Started by Barry Kelly on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
The script doesn't work unmodified under Cygwin, so I rewrote it, and with a couple more options....
This script looks like it'll do the job:
#!/bin/bash # Author: Sunil Alankar ## # recursive kill, albeit not without some minor caveats.
|
|
Helloe, i have a bash script that i need help with:
#!/bin/bash if [ -f "/suid.old" ] then find / -perm -4000 -o -perm -2000 ls > suid.old else find / -perm 4000 -o -perm -2000 ls > suid.new diff suid.old suid.new > newchanges.list fi
when i ...
Started by su on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at serverfault):
Since find prints directory, but later it's created....
They should look like find / -perm -4000 -0 -perm -2000 > suid.old
the way you have it setup find thinks that ls is a path argument.
Remove the 'ls' from your find lines.
|
Ask your Facebook Friends
|
Essentially, I would like something that behaves similarly to:
cat file | grep -i keyword1 | grep -i keyword2 | grep -i keyword3
How can I do this with a bash script that takes a variable-length list of keyword arguments? The script should do a case-insensitive...
Started by Siou on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
EXPR}
Use this as a script
#! /bin/bash awk -v IGNORECASE=1 -f <( P=; for k; do [ -z "$P" ] && P for that, but:
#!/bin/bash unset keywords matchlist keywords=("$@") for kw in "${keywords[@]}"; do if (( count == qty )) then echo....
|
|
I'm trying to write a bash script (in Ubuntu) that will backup a directory using tar.
How can I do a check in the script so that it can only be run as root (or with sudo)?
For instance, if a user runs the script, it should say that this script must be...
Started by Cory Plastek on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at serverfault):
What is your objective here, to inform the user that they should run the script as root to stop a user from copying the script, taking....
To pull the effective uid use this command:
id -u
If the result is ‘0’ then the script is either.
|
|
The title is rather more simplified than the functionality I am trying to express in a script.
I have a one-level deep directory tree (much bigger than example) which contain various content, although only two particular files are of interest to me. A...
Started by j pimmel on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
If it's one level deep, this should work:
for c in */current; do cat ${c} >> ${c%%current}revisions; done
for i in */current; do cat "${i}" >> "{i%/*}/revisions" done
Note that this will create revisions if it doesn't exist. .
|
|
Hi,
I have two folders, for arguments sake /Volumes/A and /Volumes/B. They are mounted network shares from a Windows server containing a load of .bkf files from Backup Exec.
I am looking for a script which will look into both folders and find the most...
Started by Shaun Johnson on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Is done with: find /Volumes/[AB] -name '*.bkf'
Sorting files by modification time is done with: ls -t
if load of files is not that much, you can simply use:
ls -lrt `find /Volumes/[AB] -name '*.bkf) is:
find /Volumes/[AB] -type f....
|
|
Hello
I have just migrated to a UNIX workstation. My memory of Bash shell scripts has faded since school and I find the syntax to be highly confusing. I am wondering what other scripting languages are used to automate tasks. The two most popular ones ...
Started by Scott Davies on
, 11 posts
by 11 people.
Answer Snippets (Read the full thread at serverfault):
Beyond that, perl and python are popular these days; I'm different tasks:
Bash....
Just guessing though, dunno if anyone has done from scratch, it's probably best to (re-)learn bash.
That bash is most widely used, probably followed by perl.
|
|
Any way to do this?
I have a script that exports a few vars and runs a component.
I'm looking to find out the actual values of some of these vars while the process is running. (Which applies here, because I'll be incorporating those values into another...
Started by Monster on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Maybe trap....
You could write the metadata to stdout potentially.
If you in your bash script export some environment variables, than the script respond to a "kill" signal so as to extract it's runtime information using "trap".
But ...
|
|
How do I get the path of the directory in which a bash script is located FROM that bash script.
For instance, lets say I want to use a bash script as a launcher for another application. I want to change working directory to the one where the bash script...
Started by Jim Robert on
, 19 posts
by 19 people.
Answer Snippets (Read the full thread at stackoverflow):
`pwd`
(remember the backtics) will get you the current directory from within your bash script a bash extension....
And not where you run the script from:
#!/bin/bash $orpath = 'set original path'; $path = `pwd`; if [ $path.
|