NOOB - Scripting to make an App work


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers NOOB - Scripting to make an App work
# 15  
Old 01-21-2011
you're probably right. i'll try it with the change.
# 16  
Old 01-21-2011
Quote:
Originally Posted by jscan
@DGPickett - every one of my efforts at linking have failed. i don't know much about it, but i can say with certainty that i have had NO luck with getting the linking to work. not even the glimmer of hope :-(
Clone tree linking is hard links, so most programs have no problem. The clone tree is real duplicate directories, but the files are hard linked, not sym-links, which is to say they are file inodes that happen to have a link count > 1. However, speed and space have not been identified as concerns! (I wonder if you can hard link a symlink? Smilie)

Last edited by DGPickett; 01-23-2011 at 12:56 PM..
# 17  
Old 01-25-2011
i'm losing my mind over this!

if i run the following script in ANY local user's account, it works just fine.
Code:
#!/bin/tcsh -f

## Properties
set defGrp = staff
set td = "~/Library/Application\ Support/RMS"

if ( -d {td} ) then
	echo ""
	else
	cp -R "/Users/admin/Public/RMS" ~/Library/Application\ Support/
	/usr/sbin/chown -R ${1}:${defGrp} ~/Library/Application\ Support/RMS
endif

but it WILL NOT work as a loginhook.

does anyone have any thoughts? i've now lost three days of work in trying to get this thing to work properly!

Last edited by Scott; 02-01-2011 at 12:00 PM.. Reason: Code tags
# 18  
Old 01-25-2011
Does anything come up on the screen to show what happened? Maybe since in loginhook you are still root, the ~ is /:

Mac OS X: Creating a login hook
# 19  
Old 01-28-2011
@ DGPickett - it looks like syntax errors, likely caused by the fact that i have no idea what i'm doing :-)

i tweaked everything, went back to square one, re-did everything in bash, and i'm ready to try again. here's what i'm starting with:

Code:
#!/bin/bash
RMS_LOCATION="/Users/admin/Public/RMS"
DIR="$1/Library/Application Support/RMS"
if [ -d $DIR ]; then
echo ""
else
cp -R $RMS_LOCATION $DIR
chown -R $1 $DIR
fi
exit 0

---------- Post updated at 09:08 AM ---------- Previous update was at 08:42 AM ----------

running script manually produces the following error:
Code:
/Library/Scripts/rms_bash.sh: line 4: [: /Library/Application: binary operator expected
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-pvX] source_file target_file
       cp [-R [-H | -L | -P]] [-fi | -n] [-pvX] source_file ... target_directory
chown: /Library/Application: Invalid argument


Last edited by Scott; 02-01-2011 at 11:59 AM.. Reason: Use code tags, please!
# 20  
Old 01-28-2011
It seems like [ -d is not working, try logging echo "DIR='$DIR'" >>logfile. In original unix, [ is a second name for test in /bin, but later shells do the same as a built-in.

Also, does not address group of final tree..
# 21  
Old 01-31-2011
As a login hook do this: (COPY AND PASTE IT EXACTLY)
Code:
#!/bin/bash
RMS_LOCATION="/Users/admin/Public/RMS"
DIR="/Users/$1/Library/Application Support/RMS"
if [ -d "$DIR" ]; then
echo ""
else
cp -R $RMS_LOCATION "$DIR" ||mkdir 
"/Users/$1/Library/Application Support/RMS" && cp -R 
/Users/admin/Public/RMS/* 
"/Users/$1/Library/Application Support/RMS"
chown -R $1 "$DIR"
fi
exit 0

---------- Post updated at 11:54 AM ---------- Previous update was at 11:50 AM ----------

You have spaces in your $DIR, you need to double quote it you silly goose.. Should work now.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Total Noob BASH scripting question

Hello All, I have a file of ip addresses called activeips.txt What I'm trying to do is run a simple bash script that has a loop in it. The loop is a cat of the IP addresses in the file. The goal is to run 2 nmap commands to give me outputs where each address in the list has an OS... (11 Replies)
Discussion started by: Dirk_Pitt
11 Replies

2. Shell Programming and Scripting

Noob to scripting needs some assistance

Hello, I am in a Unix class and have been out of town. I have been tasked to generate a couple of scripts and ahve never done it before. I have a virtual machine running Ubuntu. The task is below Prompt the system administrator for all valid input parameters Generate a menu to ask which... (1 Reply)
Discussion started by: jkeeton81
1 Replies

3. Shell Programming and Scripting

Noob Expect Scripting Question

I'm having some difficulty with convincing Expect to do what I need.. I have a loop that waits for input, a specific phrase of text followed by a single word. I need Expect to capture that word following the specific phrase. It should then store the word in a variable. I'm fairly sure it's... (6 Replies)
Discussion started by: LongLeafTea
6 Replies

4. Shell Programming and Scripting

Noob to Shell Scripting

Hello. I'm attempting to create a shell script to assist me by saving time with one of my hobbies. I am an Android Enthusiast and currently build a few roms for one of the devices. One of the roms I make is ported from a different device to mine (I get the original for the HTC Desire HD and... (3 Replies)
Discussion started by: JHutson456
3 Replies

5. UNIX for Dummies Questions & Answers

Noob scripting question with android ADB commands

Hi I'm pretty new to scripting and I've been googling around looking for an answer but have yet to come up with a proper solution. I work with multiple android devices at a time and I'm looking to simplify my life with a script. Basically I'm looking for a script that takes the device ID's and then... (2 Replies)
Discussion started by: Onyoursix
2 Replies

6. Shell Programming and Scripting

how to make this work

hi, I have been trying to make my script work but could not, tried some of the suggestions from here but I am not getting the correct result. I have a script that was Param1 ="$1" Param2 ="$2" $Script1 log -t "$param1" "$param2" | grep operation > /dev/null || { echo "Message"... (1 Reply)
Discussion started by: rider29
1 Replies

7. Shell Programming and Scripting

Why does my script not work? (Noob Alert)

I am a scripting noob and I have tried to search on google, but cannot find the answer as to why this script doesn't work properly. The idea of this script is that it will list all files starting with f in a certain folder, and delete all but the three newest one. I am trying to achieve this by... (4 Replies)
Discussion started by: bronkeydain
4 Replies

8. Programming

HOWTO: Calculate the balance of work in multi-threaded app.

I was wondering if anyone could give me a good idea how to calculate how balanced the threading is on a multi-threaded application. I want a percentage, such as "threads are 80% balanced." This is the way I am currently going about it, maybe it is good, maybe not. First, whenever a thread... (2 Replies)
Discussion started by: DreamWarrior
2 Replies

9. Shell Programming and Scripting

How to make this work

Dear All, I want acces my folder that name Log , that throught /export/home/hmi/bin/log. I want direct to Log folder. When I try using alias, i'm login as root: >alias logfile='cd /export/home/hmi/bin/Log' and when I execute > logfile this is work, but after I logout and login again as... (3 Replies)
Discussion started by: heru_90
3 Replies

10. Programming

Using make utility to create an mini-app

The following is my makefile. When I run "make", it gives me a bunch of error. I've compiled each file separately and there are no compilation errors. The target is "monprc". Have a look below: monprc: monprc.o monrep.o dsz.o cc -o monprc monprc.o monrep.o dsz.o monprc.o: monprc.c... (1 Reply)
Discussion started by: Yifan_Guo
1 Replies
Login or Register to Ask a Question