|
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
|
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.
|
|
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.
|
|
What is the best way to organise the sh/bash/python scripts you collect and write on your system?
Started by badp on
, 8 posts
by 8 people.
Answer Snippets (Read the full thread at superuser):
('alias' here referring to doskey....
Export PATH="$( find /home/dsm/code usage for things that don't need to be backed up as often)
Scripts stay in dev, and if I find myself.
For example:
dsm@localhost:~ $ cat .bashrc ...
To my $PATH.
|
|
The way you would normally include a script is with "source"
eg:
main.sh:
#!/bin/bash source incl.sh echo "The main script"
incl.sh:
echo "The included script"
The output of executing "./main.sh" is:
The included script The main script
... Now, if you...
Started by Aaron H. on
, 8 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
:
#!/bin/bash source $(dirname $0)/incl.sh echo "The main script"
I'd suggest that you create a setenv recommend a configurable variable at the top of your script:
#!/bin/bash installpath=/where/your/scripts script....
|