Simple script
Can someone please help me write a script that will perform the following commands together:
Code:
tar zcvf aria2.tar.gz /etc/aria2.conf /etc/init.d/aria2 Thanks in advance. |
Just write a script and add a wait state.
It looks rather simple to me. First command wait second command wait And so on. |
you dont need to add a 'waitstate' the next command will not start until the current command terminates.
|
Quote:
Don't know what I was thinking. I will blame late :D. |
We all suffer from mushy brain syndrome sometimes :)
|
How do I write the script?
Can someone please give an example. Thanks. |
this is very basic scripting, please show what you have tried yourself, we are not going to write this script for you.
|
Quote:
Also, you have already written the script...put those commands in a file...make it executable. There is your script. |
Quote:
Code:
#!/bin/sh |
Thank you joe_2000 for the example. I already tried this before I asked for help. I always receive this error message at the end:
Code:
tar: \r: Cannot stat: No such file or directory |
If you had posted this as you were asked to do earlier your problem could have been solved.
Looks like you dont have linux line endings, the \r is a carriage return and is not used in linux it is used in windows, I assume you have wriiten your script on a windows machine, using somthing like notepad, you need to use linux endings ( \n ) so use a linux text editor, leafpad for example. |
Do you see all those \r? That's a carriage return. Usually happens when you move text from a system like Windows to Unix-like.
You need to remove them first. Code:
sed -e 's/\r$//' file_with_carriage > file_without_carriage |
... or just use the std tool dos2unix.
But, as above, if you write the script on Linux in the first place, this will not be an issue. |
Thanks Keith Hedger, I wrote it in nano and it is working perfectly now :)
I previously used Notepad++ on Windows. Didn't think it would cause any problems, learnt something now :D I am really enjoying learning a lot about Linux being a long time Windows users. Thanks everyone for your contributions. |
Quote:
Not only do they prove you actually tried something for yourself but they also provide pointers as to what went wrong. Furthermore, before even posting a question: When you get error messages, copy and paste them into the search engine of your choice. Chances are that someone has had this problem before you, and the solution is already available on the web. |
All times are GMT -5. The time now is 11:39 PM. |