- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- ksh script problem
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2002 08:35 PM
06-20-2002 08:35 PM
I've inserted .ksh file for the purpose of changing the numeric user ids of several users in a filesystem.
Problem is, it contains errors listed below whenever I try executing it:
ChangeUID.ksh[3]: =: not found
ChangeUID.ksh[7]: =: not found
Test
ChangeUID.ksh[17]: =: not found
uname =
ypmatch: 1831-150 Cannot match key passwd.byname in map file
Reason: no such map file in server's domain.
ChangeUID.ksh[20]: =: not found
uid =
ChangeUID.ksh[23]: =: not found
file =
not within specified range
Test
...... and the same block of errors just keeps repeating itself for other entries in the text file fileList.txt.
I've tried running the exact ypmatch portion over the console, & it works OK, but not during execution of the script.
Can anyone help?
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2002 09:12 PM
06-20-2002 09:12 PM
Re: ksh script problem
if ["$?" !="0"]
should be
if (($? != 0))
since you're evaluation numbers you can use "((". Then your variable assignments are all wrong ..
$uname = `echo $line |awk '{print $3}'`
should be (use some other name because uname is a command but that's besides the point, if you want to assign a value to a variable don;t use $ in that variable until you want to call it later)
username=`echo $line | awk '{print $3}'`
Next ..
$mypasswdfile = `ypmatch $3 passwd.byname > passwd file`
..here you are redirecting output from ypmatch to a file "passwd" and "file" ? And at the same time you want to assign file filename to a variable ..? Not sure what you're trying to do here. I think this is what you actually wanted ?
ypmatch $3 passwd.byname > passwd-file
mypasswdfile=passwd-file
Then ..
$uid = `id $uname`
same argument ... no "$" sign ..
UID=`id $username`
and it goes on ..
It would be better if you can show the content of "fileList.txt" and describe again what you want the script to do and if it's not me, someone else will come up with a workable script for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2002 09:37 PM
06-20-2002 09:37 PM
Re: ksh script problem
Two major syntax mistakes (I am not looking at the semantics):
1) you should not but a dollar sign for the variable name in the assignment. That is perl syntax, not ksh syntax. Example:
Instead of:
$allowedDir = /usr/home/oper1/cleaw/UID
It should be:
allowedDir = /usr/home/oper1/cleaw/UID
2) There must be a space between then starting [ and ", a space between = and " and a space between the ending " and ]. Example:
Instead of:
if ["$?" !="0"]
It should be:
if [ "$?" != "0" ]
Once this is fixed, the syntax errors listed on lines 3, 7, 17, 20, 23 will be fixed.
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2002 10:02 PM
06-20-2002 10:02 PM
Re: ksh script problem
I forgot to include the file "fileList.txt"
It is an output from 'ls -l'.
I'm including it in this reply message.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2002 10:36 PM
06-20-2002 10:36 PM
Re: ksh script problem
Regards,
Trond
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2002 12:11 AM
06-21-2002 12:11 AM
Solutionif ["$?" !="0"] should be:
if [ "$?" != "0" ] (use spaces)
Two:
$uname = `echo ..` should be:
uname=`echo ..` (no $ in ksh)
(and other cases...)
So.. take care of your spaces and $-signs in Ksh.
In short:
var=`uname -a`; echo $var
and not:
var = `uname -a`; echo $var
and not:
$var = `uname -a; echo $var
Regards,
Ceesjan