Shell Script Problem
Hi This is Anirban.This is my first posting in this site.
I am trying to write a simple shell script that will search for a specific files ( e.g. .txt) from one directory;move the files to another directory and mention the time when the job is done.I am facing some problems. when i am searching for a specific file pattern by writing #! /bin/bash cd /tmp ls -l | grep txt* > /misc/backup date >> /misc/backup This script is executing but sometimes i can only see the date by issueing cat /misc/backup and sometimes it shows there are txt files ( e.g. a.txt, b.txt) in /misc/backup but i am not able to see the files individually.When I am adding the following line in this script [ mkdir /misc/backup] files are not redirected to the directory.An error messege is showing /misc/backup is a directory.Before executing the script i am doing chmod 744 backup.sh and i am executing the script by ./backup.sh. Thanks and regards in advance Anirban Adhikary. |
If you want to move the files:
Code:
#!/bin/sh [edit]Thinking about it, the * wildcard may cause problems, if so just remove it. The script should work anyway. BTW I hope this isn't a homework question :) [/edit] |
All times are GMT -5. The time now is 11:59 PM. |