Script runs but does not execute rm -rf command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script runs but does not execute rm -rf command
# 8  
Old 03-02-2013
Thanks Corona!

I kind of understand it.

? is in the original script what does IFS="$" mean?

In the little bit of code you supplied:

done < /path/to/listofnames

does that mean the path to a file that has a list of names separated with a comma??

And the .... you have above it would be the meat of the script. This is just so I'm clear!

BTW is there a means of taking a file and altering its date? It'd be nice so i can test this on a VM I have set up.

Thanks much for all your help!

I'm such a noob! SmilieSmilie
# 9  
Old 03-04-2013
I think the line
Code:
IFS="$"

has no meaning in your script.
Code:
done < /path/to/listofnames

redirects standard input of the whole while loop, so the read reads from it.
# 10  
Old 03-04-2013
On top of what MadeInGermany provided:
Quote:
Originally Posted by MrBiggz
. . .
does that mean the path to a file that has a list of names separated with a comma? . . .
According to the IFS assigned in above script snippet, they should be space separated.
Quote:
. . . BTW is there a means of taking a file and altering its date? . . .
Ever tried touch file?
# 11  
Old 03-04-2013
Quote:
Originally Posted by RudiC
On top of what MadeInGermany provided:

According to the IFS assigned in above script snippet, they should be space separated.
Ever tried touch file?
Not in a unix/linux environment .. php yes. I'll take a look at that command though! Thanks!

Quote:
Originally Posted by MadeInGermany
Code:
done < /path/to/listofnames

redirects standard input of the whole while loop, so the read reads from it.
I'll take that as a yes! =)

I'll have to do little homework on it, doesn't seem it should be that difficult.

Thx again!
# 12  
Old 03-04-2013
Hi,

try this instead...

Code:
find -P /home/${cpanel_username}/mail/${domain}/${username}/ -type f -mindepth 1 -maxdepth 1 -mtime +60 -exec rm -rvf {} /; > removed.log
cat removed.log

let know, if it works.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Execute ssh command with additional terminal command to any remote user not working script

Hello i am having an issue with bash script and this is the code now=$(cat hosts1.txt | awk '{print $2;}') while read n ;do ssh root@$now 'useradd test1; echo -e "test1\ntest1" | passwd test1 && echo "test1 ALL=(ALL:ALL) ALL" >> /etc/sudoers' When i execute only part with cat, it... (8 Replies)
Discussion started by: tomislav91
8 Replies

2. Shell Programming and Scripting

Sql command inside shell script runs without giving anything back as outout

#!/bin/sh # This script returns the number of rows updated from a function echo "The execution is starting ....." sqlplus -silent $UP <<EOF set serveroutput on set echo off set pagesize 0 VAR no_rows_updated NUMBER; EXEC :no_rows_updated :=0; DECLARE CURSOR c_update is SELECT * FROM... (4 Replies)
Discussion started by: LoneRanger
4 Replies

3. Shell Programming and Scripting

Script runs in command-line fine but times out in CRON?

Hi, I have a script that seems to run to completion when in the command-line, but when it is run using the cron, it seems to time out. They both start and run fine, but on the CRON it stops prematurely. The script hits an API every few seconds and grabs data. Does anyone have any idea on... (4 Replies)
Discussion started by: phpchick
4 Replies

4. Shell Programming and Scripting

When i am trying to execute export command within a shell script it is saying command not found.

I am running the export command within a view to use that value inside my build script. But while executing it it is saying "export command not found" My code is as follows: -------------------------- #!/bin/sh user="test" DIR="/bldtmp/"$user VIEW="test.view1" echo "TMPDIR before export... (4 Replies)
Discussion started by: dchoudhury
4 Replies

5. UNIX for Dummies Questions & Answers

How to execute command after telneting in shell script?

Hi , I have to write a shell script to telnet to specific host and execute the admin command there. Please help me to do that. Eg : telnet hostname portno admin command exit (3 Replies)
Discussion started by: arukuku
3 Replies

6. Shell Programming and Scripting

CRON shell script only runs correctly on command line

Hi, I'm new to these forums, and I'm hoping that someone can solve this problem... To make things short: I have DD-wrt set up on a router. I'm trying to run a script in CRON that fetches the daily password from my database using SSH. CRON is set like so(in web interface): * * * *... (4 Replies)
Discussion started by: louieaw
4 Replies

7. Shell Programming and Scripting

Shell script runs fine in Solaris, in Linux hangs at wait command

HI, I have a strange problem. A shell script that runs fine on solaris. when i ported to linux, it started hanging. here is the core of the script CFG_FILE=tab25.cfg sort -t "!" -k 2 ${CFG_FILE} | egrep -v "^#|^$" | while IFS="!" read a b c do #echo "jobs output" #jobs #echo "jobs... (13 Replies)
Discussion started by: aksaravanan
13 Replies

8. Shell Programming and Scripting

awk command in script gives error while same awk command at prompt runs fine: Why?

Hello all, Here is what my bash script does: sums number columns, saves the tot in new column, outputs if tot >= threshold val: > cat getnon0file.sh #!/bin/bash this="getnon0file.sh" USAGE=$this" InFile="xyz.38" Min="0.05" # awk '{sum=0; for(n=2; n<=NF; n++){sum+=$n};... (4 Replies)
Discussion started by: catalys
4 Replies

9. Shell Programming and Scripting

how to execute a sh command from a csh script

Hi everyone, I have a csh script that works fine but the output of an rsh command is different if I use boune shell instead cshell. Is there the possibility to execute only this command in bourne shell from a script declared cshell? Thanks Christian (2 Replies)
Discussion started by: bonovox
2 Replies

10. Shell Programming and Scripting

shell script to execute user command

I don't know why the following shell script doesn't work. Could you please help me out? #!/usr/bin/ksh test="cal > /tmp/tmp.txt 2>&1" $test I know it will work for the following format: #!/usr/bin/ksh cal > /tmp/tmp.txt 2>&1 However, I need to get the command from the user in... (1 Reply)
Discussion started by: redtiger
1 Replies
Login or Register to Ask a Question