Bash script - im missing something and cant's figure out what
I just put together a script for work that will essentially automate the migration of our Windows fileserver to my newly created Debian based SAMBA server.
My script will create the necessary directories then copy the data over to my new server, after that it will set the ACL's by using getfacl/setfacl.
I tried to run my script by using ./man_fs2-copy.sh:
I also tried to run the script like this, sh man_fs2-copy.sh and I get the following error,
It looks to me like you're missing a do at the start of the while:
I've changed your indention to be what I think you intended as far as loop structure is concerned. Bash didn't complain about a bad loop var when I changed and ran the script through -n syntax checking.
Thanks alot for your help. That fixed those errors
---------- Post updated at 10:10 PM ---------- Previous update was at 08:57 PM ----------
I fixed the issue that I was having but im now having trouble with another part of my script, specifically when I try to do the getfacl/setfacl.
Setting ACLs from "/home/man_fs2/e/couplings*" to "/servers/man_fs2/couplings":
getfacl: "/home/man_fs2/e/couplings*": No such file or directory
Usage: setfacl [-bkndRLP] { -m|-M|-x|-X ... } file ...
It's difficult to say for sure, but your problem might be the quotes:
I think they should go....
By quoting the variable $source, you don't allow for any file glob expansion. Thus /home/man_fs2/e/couplings* does not expand and the file with the splat (*) at the end does not exist. This assumes that there are multiple files in /home/man_fs2/e/ that start with couplings.
If couplings is a directory, and you wish to have all files in the directory processed, then in addition to dropping the quotes, you'll need to add a slant:
This is speculation as I don't really know what your source directory structure looks like. With luck this is it, and if not I hope it helps get you going again.
Hi Again,
I have a file that contains date and time for the past 2 hours. What i need is add missing date and time in a file.
INPUT
2016-01-13 01:33 10
2016-01-13 01:31 10
2016-01-13 01:30 10
2016-01-13 01:29 10
2016-01-13 01:28 10
2016-01-13 01:27 10
2016-01-13 01:26 10
2016-01-13... (14 Replies)
Hi!
(I guess this could of gone into the scripting forum, but Unix for Dummies seemed more appropriate. Please note that I am not in school, so Homework doesn't seem appropriate either. You guys can let me know if you think otherwise.)
I am following an exercise in a book on ksh scripting which... (2 Replies)
hii please help me this is the script
num=$1
sum=0
while
do
x=`expr $num % 10`
sum=`expr $sum + $x`
num=`expr $num / 10`
done
echo "Summation is $sum"
it is giving error
pratyush@ubuntu:~$ sh shell.sh 123
shell.sh: 11: 123: not found
Summation is 0 (3 Replies)
Gey guys,
I'm a new learner of perl. Now I encountered a problem when I tried to get the output below from the input file.
Input:
5'h1f, 16'h8210
write, 5'h10, 16'h0000
write, 5'h11, 16'h0000
5'h1f, 16'hffd0
write, 5'h1e, 16'h0000
5'h1f, 16'h8310
read, 5'h10, rd_data
5'h1f,... (3 Replies)
If I have a file called file A with a list of filenames. How do I find all the filenames in file A that aren't contained in file B?
I want to use bash scripting. (2 Replies)
Before I begin with the question, I just want to point out that I just started learning unix in the middle of last week, so my code (and knowledge of how unix operates) is weak sauce. I took my best stab at this question but it's just not working.
Assignment:
Create a script named... (1 Reply)
Ok, i've been messing around in debian the past few days, setting up programs like subversion, mysql and logrotate. The purpose of this script is to use subversion to backup the binary logs. It runs in the cron every 2 hours or so (although I can't get my script to run properly atm, which is why... (1 Reply)
First off thank you for any help.
Here is the problem. I have two text files that fit the same format. The first I created using an ls -d command and then with the help of the forums ran awk resulting in the fallowing output.
W00CHZ0103345-I1CZ44
W00E6S1016722-I01JW159... (8 Replies)
I change my default shell to zsh but can't find the init files, .zshrc and .zlogin from /export/home and /home. The other shells init files are there:.cshrc, .profile and .login. Am I suppose to use these as templates?
Also, bash_history is there but not zsh_history although zsh do keep a... (2 Replies)