I'm new to scripting and I need help with a bourn shell script. What i'm trying to do is a test condition where "if the time is within 2 hours, it's true" and so on.
The time is in the following format
DATE=`/bin/date +"%Y%m%d%H%S"`
for example, 20060907152000.
So, what the script first... (9 Replies)
What would be the best way or method to determine or test for the shell interpreter at the beginning of a script in the event one shell is not available?
If I use the following:
#!/bin/bash
and /bin/bash is not available, then use I'd like to use /bin/ksh if it is available.
#!/bin/ksh (8 Replies)
I need clarification in -a test.
If say, in test -a left expression is not present but the right expression is present, do the shell will consider the left expression true and evaluate the right expression?
For example:
if ]
then
rm -f ${file}
fi
Is this test condition... (7 Replies)
Hi
I am having a question where I have to
1) Identify the number of files in a directory with a specific format
and if the count is >1 we need to concatenate those two files into one file and remember that in the second file the header should not be copied. it should be form first file.... (4 Replies)
I want to test connectivity between different servers with my server using information as IP and port only.
I have Name,IP List and port in one file. Please help how i can test connectivity is successful or not?
File format will be:
Name1,127.0.0.1,80
Name2,127.0.0.2,8080
Output could be ... (1 Reply)
Hi,
I am trying to write a small script that validates if there exist files that start with a pattern in a given directory. Below is the piece of my script:
#!/usr/bin/ksh
BTFDIR=/opt/ships/temp
if
then
echo 'found'
else
echo 'not found'
fi
When I run this... (2 Replies)
Hi,
Is there any simple way to get/identify the variables that are used in a file and print those variable names. If I have something like this in a file,
/$var/temp_dir/${var2}${var3}.log
I want to display the variables 'var', 'var2' and 'var3' from that file. I tried something like... (6 Replies)
Dears ,
kindly I wanna do test for one KSH script to know how is it working , the problem that I'm facing is whenever put "sh -x ./my_script.sh"
the output seems very long & although I tried to to redirect it to files as it shown , but it failed :eek: :-
sh -x ./my_script.sh >... (2 Replies)
Hi,
I am running my pipeline and capturing all stout from multiple programs to a .txt file. I want to go into that .txt file and search for specific lines, and finally print those lines in a second .txt file.
I can do this using grep, awk, or sed for each line, but have not been able to get... (2 Replies)
Discussion started by: hmortens
2 Replies
LEARN ABOUT OPENSOLARIS
setusershell
getusershell(3C) Standard C Library Functions getusershell(3C)NAME
getusershell, setusershell, endusershell - get legal user shells
SYNOPSIS
#include <unistd.h>
char *getusershell(void);
void setusershell(void);
void endusershell(void);
DESCRIPTION
The getusershell() function returns a pointer to a legal user shell as defined by the system manager in the file /etc/shells. If
/etc/shells does not exist, the following locations of the standard system shells are used in its place:
/bin/bash /bin/csh
/bin/jsh /bin/ksh
/bin/ksh93 /bin/pfcsh
/bin/pfksh /bin/pfsh
/bin/sh /bin/tcsh
/bin/zsh /sbin/jsh
/sbin/pfsh /sbin/sh
/usr/bin/bash /usr/bin/csh
/usr/bin/jsh /usr/bin/ksh
/usr/bin/ksh93 /usr/bin/pfcsh
/usr/bin/pfksh /usr/bin/pfsh
/usr/bin/sh /usr/bin/tcsh
/usr/bin/zsh /usr/sfw/bin/zsh
/usr/xpg4/bin/sh
The getusershell() function opens the file /etc/shells, if it exists, and returns the next entry in the list of shells.
The setusershell() function rewinds the file or the list.
The endusershell() function closes the file, frees any memory used by getusershell() and setusershell(), and rewinds the file /etc/shells.
RETURN VALUES
The getusershell() function returns a null pointer on EOF.
BUGS
All information is contained in memory that may be freed with a call to endusershell(), so it must be copied if it is to be saved.
NOTES
Restricted shells should not be listed in /etc/shells.
SunOS 5.11 1 Nov 2007 getusershell(3C)