I have an rsync command that I want to create a variable where user can change to customize the parameters.
complete rsync command to run:
What I want to do is separate our the parameters into a variable:
Then I modify the rsync to run as below:
But it doesn't work. I get syntax error. But when I echo out the command, it is same as the original command.
Any idea how to solve this?
Last edited by Scott; 01-17-2011 at 07:00 AM..
Reason: Please use code tags
When you assign the string to the variable $rsync_param it will take the [bold]current[/bold] value of the variable $LOG_FILE, which may or may not be set (you haven't shown any context) so that when rsync comes to run it sees --log-file=
which would be a syntax error.
I've run into this issue when I wrote an rsync script, in which I had to eval the command to get things to work properly, as in:
To demonstrate what is happening, I created a quick script to display the number of parameters, and the parameters themselves:
And here are the results:
Which is as expected. But if we: ${ARGS} is expanded into four tokens. Double-quoting doesn't help either:
What you need to do is have the shell re-parse your command line, so that it is recognizes the quoting within your variables:
Or without the quotes:
Be warned, the script will evaluate the command line twice. Be careful with characters that will cause command line expansion.
This User Gave Thanks to m.d.ludwig For This Post:
Hi All,
Am getting the raw report from the source and need to prepare the custom report as per the requirement.
Requirement keep getting change according to the need.
Raw data is as below
/* ----------------- test_job_hu ----------------- */
insert_job: test_job_hu job_type: CMD... (4 Replies)
Hello Good Day / Guten Tag....
I have to login the server and the user profile contains some scripts which need the inputs to be taken from the keyboard.
So I use the method to conn.authenticateWithKeyboardInteractive(username, new InteractiveCallback() {
public String... (1 Reply)
Hi,
I want to configure nagios core with my own scripts.Default configuration has been done like ping,http,Root partition,..so on...
But according to my requirement i have a script called cpumon.sh which will monitor the current cpu usage.
I gone through below link but could not find out... (1 Reply)
I have a jump off server, which grants SSH access to a few other servers.
I would like to create a custom shell which can be assigned to specific user accounts which runs a menu script upon login, where they can select which server they want to jump too, however should they hit ctrl-c or any... (1 Reply)
hi
I am trying to make my own commands in my linux.I thought a command for changing directories will be easy.
I made a simple file amd made the entries
#!/bin/bash
cd /opt/mydir
I then made the file executable and then moved it to /usr/bin.
But when i type the script name nothing... (2 Replies)
Hello,
On Aix 5.2, we changed the parameters tcp_keepinit, tcp_keepintvl and tcp_keepidle with the no command.
tunrestore -R is present in inittab
in the directory /etc/tunables we can clearly see the inclusion of parameters during reboot, including the file lastboot.log
... (0 Replies)
Hi.
I hope someone can help me. I have e very special question.
I have a Lunix server and I have installed Webmin on it. This way, I can create a login for an other user and give him restricted access to some custom commands I set up.
One of the commands i would like to setup, is for him to... (9 Replies)
A program named /usr/bin/aa.sh, two parameters: 11, 22. after start it, the row in `ps -ef` is almost like the following:
root 12198 10278 0.0 Nov 25 pts/3 0:00.23 /usr/bin/aa.sh 11 22
but I want to change "/usr/bin/aa.sh 11 22" to one rule string, such as: "AA_11_22", how to... (1 Reply)