using spawn command to find the number of files in a directory.
Hi,
I was using spawn command to find the number of files in a directory. And i need to figure out the listing time using timex. i have used the below commands. /usr/bin/timex /usr/local/bin/expect <<EOF set timeout 180 spawn ls /tmp/test | wc -l expect eof EOF But I was getting the below error while executing this. /usr/bin/timex /usr/local/bin/expect <<EOF > set timeout 180 > spawn ls /tmp/test | wc -l > expect eof > EOF spawn ls /tmp/test | wc -l |: No such file or directory wc: No such file or directory -l: No such file or directory /tmp/test: real 0.02 user 0.00 sys 0.00 Can any one please help me? Regards Sreejith |
Hi,
Quote:
You could try to use quotes or double qoutes to group them together. Cheers |
Hi gdejonge,
i have tried that also before. Below is the error seen at that time. /usr/bin/timex /usr/local/bin/expect <<EOF > set timeout 180 > spawn "ls /tmp/test | wc -l" > expect eof > EOF spawn ls /tmp/test | wc -l couldn't execute "ls /tmp/test | wc -l": no such file or directory while executing "spawn "ls /tmp/test | wc -l"" real 0.02 user 0.00 sys 0.00 /usr/bin/timex /usr/local/bin/expect <<EOF > set timeout 180 > spawn 'ls /tmp/test | wc -l' > expect eof > EOF spawn 'ls /tmp/test | wc -l' couldn't execute "'ls": no such file or directory while executing "spawn 'ls /tmp/test | wc -l'" real 0.02 user 0.00 sys 0.00 |
Quote:
Code:
#!/usr/bin/expect Hope this helps some... -- Rick |
Hi Rick,
When I run the script, it is working properly. But I need to integrate the listing with timex command. I need to find how much time the lisitng is taking on the server. Sreejith |
Quote:
I was thinking that something like: Code:
#!/usr/bin/expect Back to the drawing board. -- Rick |
All times are GMT -5. The time now is 05:18 AM. |