Sponsored Content
Full Discussion: Simple bash script help
Top Forums Shell Programming and Scripting Simple bash script help Post 302483337 by dentex on Sunday 26th of December 2010 08:56:13 AM
Old 12-26-2010
Simple bash script help

Hi to everyone here,
I'm a new user and relatively-new linuxer.

I'm trying to write a script that checks if every file from a directory is present in a given list and if not, delete it.
should be simple. But I think I've done half the work only:

this is to create the reference list:
Code:
for c in `ls ~/cache`; 
    do for s in `ls ~/sel`;
        do case $c in
            $s) echo $s >> ~/installed;;
        esac 
    done
done

Now I'm not able to check again every file in the "cache" with the "installed" list and eventually delete them.

Every help is much appreciated,
thanks!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Simple Bash Script

I'm sure I'm doing something wrong but as I am new to bash shell scripting I'm not sure what: Here's the code webalizer.conf is sitting in the same directory as this file which is named webalizer.sh. Can someone tell me if I've got the syntax right -- it that's correct? I'm executing the... (3 Replies)
Discussion started by: xaphalanx
3 Replies

2. Shell Programming and Scripting

Simple BASH script?

Hi guys, I'm new to the forum so forgive me if I'm sounding ... daft. I currently work in a Tech Support role. Every day we have to generate data by running around 10 .sh scripts. I was thinking instead of having to ./filename 10 times is it possible to right a new script that will run these for... (16 Replies)
Discussion started by: JayC89
16 Replies

3. Shell Programming and Scripting

simple bash script

I am writing a shell script in bash one of the thing I want to show is size of export /home du -sk /export/home/oracle | cut -c 1-5 echo "kbytes" when I run the script kbytes shows up in the second line, How can I append kbytes on the same line, such as 61233 kbytes please guide thanks (2 Replies)
Discussion started by: Tirmazi
2 Replies

4. Shell Programming and Scripting

Simple BASH script not working?

So I need a script that does the following: If a certain user is logged in Run `command` Else Echo “incorrect user” This is my first stab...which doesn't work: #!/bin/bash X="user=`ls -l /dev/console | cut -d " " -f 4`" Y="foobar" echo $X echo $Y (4 Replies)
Discussion started by: doubleminus
4 Replies

5. Shell Programming and Scripting

simple bash script permission

I have a bash script, but it needs to have a simple protection with password. So if a user wants to run the script , there should be a kdialog to asks for a password.If the password is correct the script starts to run. It should not be the passord of root or another admin user.Just a password in... (2 Replies)
Discussion started by: poort
2 Replies

6. Shell Programming and Scripting

Help with writing simple bash script

I want to write a bash script to: 1. Send an email from localhost to an external gmail account. (gmail then automatically forwards the message back to a pop account on the same server. 2. Script waits 3 minutes then checks to see if the email arrived, and if not, it sends an email to... (9 Replies)
Discussion started by: sallyanne
9 Replies

7. Shell Programming and Scripting

need a simple bash script

to gather the cpu utilization from a system in 5 minute intervals and direct output to file. I'm new at scripting and while this seems like an easy task I'm confused on where to start. thanks for any help (1 Reply)
Discussion started by: mkeyes001
1 Replies

8. Shell Programming and Scripting

Stumped on simple BASH Script

Hello All, First and foremost, if I have posted this question in the wrong forum/section, I apologize. Okay so here is my dilemma. I have written a BASH script that automatically restarts a tomcat on a given server. That part was simple enough. However, now I would like to not only restart... (14 Replies)
Discussion started by: UNM_Lobo
14 Replies

9. Shell Programming and Scripting

Help making simple perl or bash script to create a simple matrix

Hello all! This is my first post and I'm very new to programming. I would like help creating a simple perl or bash script that I will be using in my work as a junior bioinformatician. Essentially, I would like to take a tab-delimted or .csv text with 3 columns and write them to a "3D" matrix: ... (16 Replies)
Discussion started by: torchij
16 Replies

10. Shell Programming and Scripting

Simple Bash Script - Crontab

I've put together a very simple bash script to check for software patches and bounce the server, once complete. This is on a Mac server. The script works just fine upon execution, however, cron responds with: /bin/sh: /usr/local/bin/softwareupdates.sh: No such file or directory Crontab: ... (6 Replies)
Discussion started by: Nvizn
6 Replies
RINSE(8)						 Perl Programmers Reference Guide						  RINSE(8)

NAME
rinse - RPM Installation Entity. SYNOPSIS
rinse [options] Help Options: --help Show help information. --manual Read the manual for this script. --version Show the version information and exit. Mandatory Options: --arch Specify the architecture to install. --directory The directory to install the distribution within. --distribution The distribution to install. Customization Options: --add-pkg-list Additional packages to download and install --after-post-install Additionally run the specified script after the post install script. --before-post-install Additionally run the specified script before the post install script. --post-install Run the given post-install script instead of the default files in /usr/lib/rinse/$distro Misc Options: --cache Should we use a local cache? (Default is 1) --cache-dir Specify the directory we should use for the cache. --clean-cache Clean our cache of .rpm files. --config Specify a different configuration file. (Default is /etc/rinse/rinse.conf) --pkgs-dir Specify a different directory containing <distribution>.packages files. --mirror Specify the URL of the mirror. (Default is to read it from /etc/rinse/rinse.conf) --list-distributions Show installable distributions. --print-uris Only show the RPMs which should be downloaded. default files in /usr/lib/rinse/$distro --verbose Enable verbose output. OPTIONS
--arch Specify the architecture to install. Valid choices are 'amd64' and 'i386' only. --add-pkg-list Add a list of additional packages. --cache Specify whether to cache packages (1) or not (0). --cache-dir Specify the directory we should use for the cache. --clean-cache Remove all cached .rpm files. --directory Specify the directory into which the distribution should be installed. --distribution Specify the distribution to be installed. --help Show help information. --mirror Specify the URL of the mirror. Normally this is read from /etc/rinse/rinse.conf. --list-distributions Show the distributions which are installable. --manual Read the manual for this script. --print-uris Only show the files we would download, don't actually do so. --verbose Enable verbose output. --version Show the version number and exit. DESCRIPTION
rinse is a simple script which is designed to be able to install a minimal working installation of an RPM-based distribution into a directory. The tool is analogous to the standard Debian GNU/Linux debootstrap utility. USAGE
To use this script you will need to be root. This is required to mount /proc, run chroot, and more. Basic usage is as simple as: rinse --distribution fedora-core-6 --directory /tmp/test This will download the required RPM files and unpack them into a minimal installation of Fedora Core 6. To see which RPM files would be downloaded, without actually performing an installation or downloading anything, then you may run the following: rinse --distribution fedora-core-6 --print-uris TODO
Short of supporting more distributions or architectures there aren't really any outstanding issues. AUTHOR
Steve -- http://www.steve.org.uk/ LICENSE
Copyright (c) 2007-2010 by Steve Kemp. All rights reserved. Copyright (c) 2011-2013 by Thomas Lange. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The LICENSE file contains the full text of the license. 2.0.1 2013-01-28 RINSE(8)
All times are GMT -4. The time now is 04:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy