Sponsored Content
Top Forums Shell Programming and Scripting Shell script to create local homes Post 57160 by Steve Adcock on Wednesday 20th of October 2004 04:12:48 AM
Old 10-20-2004
Hi I tried it and it makes sense but the script does not quite work yet , a bit of progress has been made at this link.

http://discussions.info.apple.com/we...736.689d315b/3

My script currently looks like this

#!/bin/sh
#
CURRUSER=`whoami`

ADMINGROUP=`groups | egrep -c admin`

if [ "$ADMINGROUP" > 0 ]
then
exit 1
fi

mkdir -p /Users/Shared/$CURRUSER
mkdir -p /Users/Shared/$CURRUSER/Movies
mkdir -p /Users/Shared/$CURRUSER/Music
mkdir -p /Users/Shared/$CURRUSER/Music/iTunes
mkdir -p /Users/Shared/$CURRUSER/Music/GarageBand



rm -R ~/Movies
rm -R ~/Music


ln -s /Users/Shared/$CURRUSER/Movies ~/Movies
ln -s /Users/Shared/$CURRUSER/Music ~/Music


I will add the chown part but it still needs something to create the $CURRUSER directories rather than roots . This last sentence makes sense if you read the input at the link above.

Last edited by Steve Adcock; 10-20-2004 at 05:18 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

shell script, reading and resetting local variables

Hello, I have a problem with trying to run a shell script that reads in user input, validates, and sets to a 'default' value if the input is not valid. I cannot get the portion of resetting to a default value to work. These lines are skipped, and the value of x is still whatever the user... (1 Reply)
Discussion started by: b888c
1 Replies

2. Linux

Local shell script need to be executed on a remote linux box

I need to execute a shell script on a remote linux box. But the shell script resides on the local linux box where I am currently logged in. Is there a way to do this? I know rsh <host> <command> can execute a command on the remote host. (6 Replies)
Discussion started by: rajeshomallur
6 Replies

3. Shell Programming and Scripting

Executing shell script on local machine

Hi guys, I need to run and test some shell script. At work, i work on ksh. I don't have any such software/client installed at home and i cannot always connect to work from home. At home i have Windows Vista. Is there a free and reliable software where i can run my ksh script? Please let me... (4 Replies)
Discussion started by: jakSun8
4 Replies

4. Shell Programming and Scripting

Help with shell script to run the commands reading options from local file

I have to use shell script to run series of commands on another unix box by connecting through SSH and giving user credentials. For running commands on remote machine I have to use options reading from a local file. Process: Connecting to remote unix server <host1.ibm.com> through ssh Login: ... (2 Replies)
Discussion started by: itsprout
2 Replies

5. Shell Programming and Scripting

Perl script 'system' linking to local shell script not working

Trying to figure out why this works: printpwd.pl #!/usr/bin/perl use CGI::Carp qw( fatalsToBrowser ); print "Content-type: text/html\n\n"; $A = system("pwd"); $A = `pwd`; print "$A\n"; ^^actually that works/breaks if that makes any sense.. i get the working directory twice but when... (5 Replies)
Discussion started by: phpfreak
5 Replies

6. UNIX for Dummies Questions & Answers

SQL block in a Shell Script connecting to a local and remote DB

Hi All, In a Shell scriipt with a SQL block I want to issue a query against a local DB and a remote DB on a remote server. The shell script is running locally. This is how I connect to the local server. But I want the query to reference remote table in the join. Question can I specify a... (1 Reply)
Discussion started by: daveu7
1 Replies

7. Shell Programming and Scripting

To run a local shell script in a remote machine by passing arguments to the local shell script

I need to run a local shell script on a remote machine. I am able to achieve that by executing the command > ssh -qtt user@host < test.sh However, when I try to pass arguments to test.sh it fails. Any pointers would be appreciated. (7 Replies)
Discussion started by: Sree10
7 Replies

8. UNIX for Dummies Questions & Answers

Copy files from Linux server local windows machine using a shell script

Hello, I need to create a shell script which will copy files - which are created on particular date and starting with particular name - to local windows XP machine. Is this possible.? Currently it is being done manually using winscp (1 Reply)
Discussion started by: NarayanaPrakash
1 Replies

9. Shell Programming and Scripting

Except script to run a local shell script on remote server using root access

local script: cat > first.sh cd /tmp echo $PWD echo `whoami` cd /tmp/123 tar -cvf 789.tar 456 sleep 10 except script: cat > first #!/usr/bin/expect set ip 10.5.15.20 set user "xyz123" set password "123456" set script first.sh spawn sh -c "ssh $user@$ip bash < $script" (1 Reply)
Discussion started by: Aditya Avanth
1 Replies

10. UNIX for Beginners Questions & Answers

How to have local shell variables in a ksh script seen on remove server in SSH block?

I have googled this and found many solutions, but none of them are working for me. I am in a korn shell, most others reference bsh, maybe that is the issue? Anyway, all I am trying to do is use a variable I have declared in my main script in a remote shell I am running through ssh. So I have a... (8 Replies)
Discussion started by: DJR
8 Replies
Sub::Exporter::GlobExporter(3pm)			User Contributed Perl Documentation			  Sub::Exporter::GlobExporter(3pm)

NAME
Sub::Exporter::GlobExporter - export shared globs with Sub::Exporter collectors VERSION
version 0.002 SYNOPSIS
First, you write something that exports globs: package Shared::Symbol; use Sub::Exporter; use Sub::Exporter::GlobExport qw(glob_exporter); use Sub::Exporter -setup => { ... collectors => { '$Symbol' => glob_exporter(Symbol => '_shared_globref') }, }; sub _shared_globref { return *Common } Now other code can import $Symbol and get their *Symbol made an alias to *Shared::Symbol::Symbol. If you don't know what this means or why you'd want to do it, you may want to stop reading now. The other class can do something like this: use Shared::Symbol '$Symbol'; print $Symbol; # prints the scalar entry of *Shared::Symbol::Symbol ...or... use Shared::Symbol '$Symbol' => { -as => 'SharedSymbol' }; print $SharedSymbol; # prints the scalar entry of *Shared::Symbol::Symbol OVERVIEW
Sub::Exporter::GlobExporter provides only one routine, "glob_exporter", which may be called either by its full name or may be imported on request. my $exporter = glob_exporter( $default_name, $globref_locator ); The routine returns a collection validator that will export a glob into the importing package. It will export it under the name $default_name, unless an alternate name is given (as shown above). The glob that is installed is specified by the $globref_locator, which can be either the globref itself, or a reference to a string which will be called on the exporter For an example, see the "SYNOPSIS", in which a method is defined to produce the globref to share. This allows the glob-exporting package to be subclassed, for for the subclass to choose to re-use the same glob when exporting or to export a new one. If there are entries in the arguments to the globref-exporting collector other than those beginning with a dash, a hashref of them will be passed to the globref locator. In other words, if we were to write this: use Shared::Symbol '$Symbol' => { arg => 1, -as => 2 }; It would result in a call like the following: my $globref = Shared::Symbol->_shared_globref({ arg => 1 }); AUTHOR
Ricardo Signes <rjbs@cpan.org> COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by Ricardo Signes. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.10.1 2010-11-23 Sub::Exporter::GlobExporter(3pm)
All times are GMT -4. The time now is 02:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy