I'm writting one script to copy a file in various folders, but there are 2 things to validate. First that the folder where i'll be cpying exists, and second that i have permissions to copy the file in it.
so far i have found the way to validate the folder exists, but when trying to copy it, don't know how to validate if it was copied, since if I don't have permission to see the folder i wont be able to do ls | wc -l
this is the code:
how to validate either the folder is there and have permissions not only to see it but also to copy a file inside of it???
Have you thought to change the permission of the file so you can read it?
chmod +r File
then cat into it.
I can't with the user i'm logged, the idea it's not to read a file, sorry if I didn't make myself clear, the idea is to evaluate if the destiny folder is available, and if so, if I have permissions to copy a file inside.
Thanks anyway Shaun.
look for file, see the chmod on left? See if you have the permissions. If the file does not appear, it is not available. At least not in that directory. Can you get into su? if not, and you are not the file owner - I cant help you.
---------- Post updated at 10:38 AM ---------- Previous update was at 09:49 AM ----------
Now, another issue, how to do the same validation on a file which is in a remote server, using the same shell script??, maybe by using telnet, ssh or even ftp???
how could it be possible?
Thanks!!!
Could somebody please explain to me why and how the highlighted line(s) (?) of code puts the "test" evaluation into "result" and then to $enable_static ? Or does not ?
I did comment out the original code and changed it to what I feel is less cryptic , but the "result" is still wrong =... (3 Replies)
I have made a simple script to find all programs that use a tcp wrapper, it will supply a reasonable default for my system if none is given.
After some digging I realized that the expansion operators pass their default return value single quoted (according to bash -x trace). I have wildcard... (2 Replies)
I have made a simple script to find all programs that use a tcp wrapper, it will supply a reasonable default for my system if none is given.
After some digging I realized that the expansion operators pass their default return value single quoted (according to bash -x trace). I have wildcard... (0 Replies)
OK, I'm striving to abide by all the rules this time.
Here is a fragment of my windows10/cygwin64/bash script:
export BUPLOG=$(BackupRecords --log "$src")
robocopy $(BackupRecords -mrbd "$src" --path "$src") $(BackupRecords --appSwitches "$src") "$src" "$dst" $(BackupRecords --fileSwitches... (15 Replies)
OK, I'm striving to abide by all the rules this time.
Here is a fragment of my windows10/cygwin64/bash script:
export BUPLOG=$(BackupRecords --log "$src")
robocopy $(BackupRecords -mrbd "$src" --path "$src") $(BackupRecords --appSwitches "$src") "$src" "$dst" $(BackupRecords --fileSwitches... (0 Replies)
Hello guys,
I'm actually working on my master thesis which has for subject the evaluation of virtual firewall in a cloud environment. To do so, I installed my own cloud using OpenNebula (as a frontend) and Xen (as a Node) on two different machines. The Xen machine is my virtual firewall thanks... (2 Replies)
Hi -
I have an expression that evaluates to "Alive" or some other condition. e.g. if I run :-
awk -F \| '{gsub(/]*/,"",$4); print $4 }'
then the output is "Alive".
I want to be able to test this as the result may be some other condition other than "Alive". I have tried the following... (4 Replies)
Hi,
Is there a way to evaluate an equation contained in a string within an AWK script?
For example:
A = "(5*2)-1" (this equation is read from a file and varies line by line)
In this example, I can't see any way to get an answer of 9 unless I do:
cmd = "awk 'BEGIN{print "A"}'"
cmd |... (3 Replies)