This is wat I have, I used "elif" before but it worked the same. Ok the first 2 if statements work but the last 2 don't. For example here are the files in your dir:
10 11.txt 12 14.txt
When you run this script: (called script1)
script1 10 - it doesn't prompt for txt extension!
It should now say "Must have txt extension!"
I don't know what I am doing wrong, this seems so simple but I can't hack it!
Correct me if i'm wrong, but by adding "#!/bin/ksh" at the start of a script will force it to run in the korn shell no matter which shell you are currently using?? (2 Replies)
I'm using solaris and i have an old script that an ex employee wrote but i can't seem to get it working. well is just one part of the script
if ($?MC_PROD_DIR == 0) setenv MC_PROD_DIR $HOME/PRODUCTION
source $MC_PROD_DIR/scripts/localenv
** i understand what this part of the script is... (1 Reply)
Can anyone help with these scripts? Im new to this and struggling. Thank you for your help.
Pre-requisites
Create a file with x amount of lines in it, the content of your choice. (Have already done this)
Script 1
Write a script that takes two arguments. The first being a line of text,... (3 Replies)
Anyone know why this won't work?
#!/usr/bin/ksh
for db in `cat /etc/oratab|egrep ':N|:Y' | grep -v \* | cut -f1 -d":"`
do
echo "************************"
echo "database is $db"
echo "************************"
done
I am getting an error on the line... (7 Replies)
Here is my problem.
I have a txt file with a list of user names in both upper case and lower case. I need to remove the names from the passwd file. I want to be able to run a script that looks at my txt list and then removes those names from the passwd file. It would be nice if it backed up the... (3 Replies)
I am trying to write a script to check the STIG our unix boxes. I want to put in checks to determine if certain files or directories are there. For example:
If /opt/SUNWexplo exists
echo "Sun Explorer exists"
else
echo "Sun Explorer is not installed"
I am sure I could write... (2 Replies)
I have a script that will calculate some information about the current directory that I run the script in. How can I have it where it gets an argument from the user(such as a directory) and the script calculate the information for the given directory? Any help is greatly appreciated. (8 Replies)
How can I include a counter in this if statement so only sends out 5 notifications.
# the if statement will check for the lines status, if status is down sends email
if
then
LIST="user@email.com"
mail -s "rje_lines_down" $LIST < ${tmpfile} #sends an email to list
fi
thanks... (2 Replies)
Gents for 2013 I have embarked on learning C and just wrote my first script and need some help. In the learning process, I am trying to understand where I went wrong with my script. The flow of the script is as such:
Enter a number --> check if it is a number --> if it is not a number,print what... (4 Replies)
Discussion started by: metallica1973
4 Replies
LEARN ABOUT DEBIAN
sysprofile
SYSPROFILE(8) System Manager's Manual SYSPROFILE(8)NAME
sysprofile - modular centralized shell configuration
DESCRIPTION
sysprofile is a generic approach to configure shell settings in a modular and centralized way mostly aimed at avoiding work for lazy sysad-
mins. It has only been tested to work with the bash shell.
It basically consists of the small /etc/sysprofile shell script which invokes other small shell scripts having a .bash suffix which are
contained in the /etc/sysprofile.d/ directory. The system administrator can drop in any script he wants without any naming convention
other than that the scripts need to have a .bash suffix to enable automagic sourcing by /etc/sysprofile.
This mechanism is set up by inserting a small shell routine into /etc/profile for login shells and optionally into /etc/bashrc and/or
/etc/bash.bashrc for non-login shells from where the actual /etc/sysprofile script is invoked:
if [ -f /etc/sysprofile ]; then
. /etc/sysprofile
fi
For using "sysprofile" under X11, one can source it in a similar way from /etc/X11/Xsession or your X display manager's Xsession file to
provide the same shell environment as under the console in X11. See the example files in /usr/share/doc/sysprofile/ for illustration.
For usage of terminal emulators with a non-login bash shell under X11, take care to enable sysprofile via /etc/bash.bashrc. If not set
this way, your terminal emulators won't come up with the environment defined by the scripts in /etc/sysprofile.d/.
Users not wanting /etc/sysprofile to be sourced for their environment can easily disable it's automatic mechanism. It can be disabled by
simply creating an empty file called $HOME/.nosysprofile in the user's home directory using e.g. the touch(1) command.
Any single configuration file in /etc/sysprofile.d/ can be overridden by any user by creating a private $HOME/.sysprofile.d/ directory
which may contain a user's own version of any configuration file to be sourced instead of the system default. It's names have just to
match exactly the system's default /etc/sysprofile.d/ configuration files. Empty versions of these files contained in the $HOME/.syspro-
file.d/ directory automatically disable sourcing of the system wide version.
Naturally, users can add and include their own private script inventions to be automagically executed by /etc/sysprofile at login time.
OPTIONS
There are no options other than those dictated by shell conventions. Anything is defined within the configuration scripts themselves.
SEE ALSO
The README files and configuration examples contained in /etc/sysprofile.d/ and the manual pages bash(1), xdm(1x), xdm.options(5), and
wdm(1x). Recommended further reading is everything related with shell programming.
If you need a similar mechanism for executing code at logout time check out the related package syslogout(8) which is a very close compan-
ion to sysprofile.
BUGS
sysprofile in its current form is mainly restricted to bash(1) syntax. In fact it is actually a rather embarrassing quick and dirty hack
than anything else - but it works. It serves the practical need to enable a centralized bash configuration until something better
becomes available. Your constructive criticism in making this into something better" is very welcome. Before i forget to mention it: we
take patches... ;-)
AUTHOR
sysprofile was developed by Paul Seelig <pseelig@debian.org> specifically for the Debian GNU/Linux system. Feel free to port it to and use
it anywhere else under the conditions of either the GNU public license or the BSD license or both. Better yet, please help to make it into
something more worthwhile than it currently is.
SYSPROFILE(8)