Hi people I am trying to learn this code and see how it relates to the old DOS days. I have a line of code that I am not sure what the first part does. Any help will be greatly appreciated.
It is from a Save command that is used to backup files to a directory.
It goes like this
That is sort of what I was looking for Jim but I am confused on the -lt part. I know this is a switch but not sure how it fits into the $#. And what does the 1 mean
Great link Jim and I thank you but OK more questions LOL
So what everybody is saying is that if [$# -lt 1]; then set /etc/ /etc/.save; fi
if the $# is less than 1 then set will show the variables in the /etc/ file? right??? then how does the /etc/.save come into play?
The next line in the code is almost like the one I just posted except that it says
if [$# -lt 2] then set $* /etc/.save; fi
So if the argument count is less than 2 then it will show the variables in the $????? I know the "" is a metacharacter but there again how or what is it doing to the /etc/.save file? This stuff is making my head spin. It seems way over my head and I am supposed to learn it. There are just too many special characters that doing different things at different times and it is confusing the hell out of me. I thought C++ was bad but this takes the cake.
OK more questions LOL
So what everybody is saying is that if [$# -lt 1]; then set /etc/ /etc/.save; fi
if the $# is less than 1 then set will show the variables in the /etc/ file? right??? then how does the /etc/.save come into play?
The next line in the code is almost like the one I just posted except that it says
if [$# -lt 2] then set $* /etc/.save; fi
So if the argument count is less than 2 then it will show the variables in the $????? I know the "" is a metacharacter but there again how or what is it doing to the /etc/.save file? This stuff is making my head spin. It seems way over my head and I am supposed to learn it. There are just too many special characters that doing different things at different times and it is confusing the hell out of me. I thought C++ was bad but this takes the cake.
What in the world is trying to be done with this line of code. Can anybody help me decipher it. It goes like this
for f in 'cat $1/.savelist'
I think it is trying to execute the command but not sure what the f is in the beginning not to mention the for at the start of this line. Can anybody shed some light. Thanks Keith
because there's a big difference between quotes and backticks.
What this does is read the values of the file '.savelist' in the directory specified at the command line ($1) into the variable 'f', looping over each one.
Yes Pludi that is what I meant and at the time couldn't find the right key but I see it now. So your saying it is going to view everything in the directory and put it in the f file??