08-20-2001
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 entered initially. Is it possible that the first x variable is not the same as the x in 'setx=10' line?
simpled version of the script
#!/bin/sh
#
echo "Enter x"
read x
echo "You entered $x"
#
# lines to validate here...
# ....
#
# I cannot get the following lines to work
set x=10
echo "x reset to $x"
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I'm a Linux newb, I've been running a Debian Linux server for about a year now, and I've written some simple scripts to automate various things, but I still don't know much, and I forget what I learn as fast as I figure it out... Anyway, that really isn't important, I just want you to know that... (14 Replies)
Discussion started by: Drek
14 Replies
2. Shell Programming and Scripting
Is it possible to make function variables local?
I mean for example, I have a script variable 'name' and in function I have declared variable 'name'
I need to have script's 'name' have the same value as it was before calling the function with the same declaration.
The way to preserve a... (5 Replies)
Discussion started by: alex_5161
5 Replies
3. Shell Programming and Scripting
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
4. Shell Programming and Scripting
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
5. Shell Programming and Scripting
Hi,
In shell script, I have a variable var = xyz, inn, day, night, calif ....n and I would like to read them in to var1 = xzy, var2 = inn, var3= day, var4 = night....var.
probably in a loop. I would like to read the variables until end of the line. Comma is the delimiter and there's no comma at... (3 Replies)
Discussion started by: suryaemlinux
3 Replies
6. Shell Programming and Scripting
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
7. UNIX for Dummies Questions & Answers
Dear Unix gurus,
We have a config shell script file which has 30 variables which needs to be passed to master unix shell script that invokes oracle database sessions. So those 30 variables need to go through the database sessions (They are inputs) via a shell script. one of the variable name... (1 Reply)
Discussion started by: dba1981
1 Replies
8. Shell Programming and Scripting
Dear Unix gurus,
We have a config shell script file which has 30 variables which needs to be passed to master unix shell script that invokes oracle database sessions. So those 30 variables need to go through the database sessions (They are inputs) via a shell script. one of the variable name... (1 Reply)
Discussion started by: dba1981
1 Replies
9. Shell Programming and Scripting
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
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
LEARN ABOUT DEBIAN
java2html
JAVA2HTML(1) General Commands Manual JAVA2HTML(1)
NAME
java2html - generates highlighted html-files from Java or C++ source
SYNOPSIS
java2html [options] [filename...]
DESCRIPTION
This manual page documents how to use java2html. If no arguments are given on the command line of java2html, it reads from stdin and
writes to stdout.
If invoked with filenames as arguments java2html will write it's output into new files. Names of output files are generated by appending
".html" to the corresponding input filename.
Installing as a CGI program
java2html can be installed as a CGI program and convert source files on the fly. In order to set this up for apache the webmaster has to
add the two lines
AddType text/x-java .java
Action text/x-java /cgi-bin/java2html
to the webserver configuration file. java2html depends on the webserver properly setting environment variable PATH_TRANSLATED to the path-
name of the source file. If java2html has been compiled with option -DCOMPRESSION=1 then it will invoke gzip to compress the generated
HTML before sending it to the requesting browser. Of course java2html takes care to check if the browser accepts gzip encoding.
OPTIONS
-- Interpret all following arguments on the command line as filenames. This is useful, if you want to convert files beginning with a
'-'.
-b filename
Insert the file 'filename' after converted data and before HTML footer. See also the -s option.
-c Turns off CGI-script detection and HTTP header generation. This is needed to use java2html as a subcommand in another CGI script.
-h filename
Insert the file 'filename' after the HTML headers and before the converted data. See also the -s option.
-i Generate an index only. This will generate a list of references (HREF's) to the labels that java2html creates for your source file.
The references are created as list items (<li>) in an HTML list. Each line has the form
<li><a href="#name">prototype()</a></li>
so they can be used directly as an index list, or further parsed by another script.
If you want the index at the top of the source file, you will need a wrapper script like this one:
#! /bin/sh
echo "Content-type: text/html"
echo ""
echo "<html>"
echo "<head><title>$PATH_TRANSLATED</title>"
echo "<meta name="generator""
echo "content="`java2html -V`">"
echo "</head>"
echo "<body>"
echo "<h1>Source of $PATH_TRANSLATED</h1>"
echo "<ul>Structures and functions"
cat $PATH_TRANSLATED | java2html -isc
echo "</ul>"
echo "<hr></hr>"
cat $PATH_TRANSLATED | java2html -sc
echo "</body></html>"
exit
-n Number lines and label them with 'line' followed by the line number. Empty lines get no label, but the linecounter will count them
nevertheless. With this feature you can refer to special lines of code from other parts of the generated file or from external files
with a line like this:
<A HREF="foo.java.html#line301">Go to line 301</A>
-s With this option you can suppress the generation of HTML headers. This is especially useful together with options -b file and -h
file.
-t title
Set the title to 'title'. The default is the filename you converted or "stdin" if reading from stdin. This option is only used if -s
is not set.
-u Print usage information.
-w width
sets the WIDTH attribute for HTML tag <PRE>. If this option is not used a default of 80 is assumed. (Currently most browsers are
ignoring this attribute).
-V reports the version number of java2html.
EXIT STATUS
java2html returns 0 on success, 1 if input files are not existing/readable, 2 if output files are not creatable/writable, 3 if invoked with
illegal options and 4 if gzip cannot be invoked.
AUTHORS
Florian Schintke <schintke@cs.tu-berlin.de>
Martin Kammerhofer <mkamm@gmx.net> wrote the CGI feature.
Rob Ewan <rob@ewan.com> wrote the indexing feature.
SEE ALSO
c2html(1), pas2html(1), perl2html(1).
JAVA2HTML(1)