Hi all, I'm confused about the proper syntax for multi-conditional if then statements. I'm trying to set limitations on info input on the command line.. i.e.
if ] ;then
$x=$vr1
else
print "You have entered an invalid option."
Can someone please clue me in on what is wrong with my syntax;... (3 Replies)
Hello everyone,
I got this type of error when programming in bash
new.bat: 16: cannot create : Directory nonexistent
$bool
new.bat: 37: Syntax error: "then" unexpected (expecting "fi")
Does anyone know why?
Here is my code
#!bin/bash
#function helps(){... (4 Replies)
Please help me. I have been doing this for several hours.
Here is the code
if then
echo a b c d >> file.txt
echo 1111 >> file.txt
fi
The reason I want the two echo is because I want these statements printed on multiple lines. I keep getting error .
First it tells me... (2 Replies)
Hi,
Hav automated a process, and it is working fine.
for first process alone
status = ` ps -ef |grep a `
if
then
echo " Success" > temp/logfile
else
echo " Failure" > temp/logfile
fi
Now I hav to write script to automated some 2 process and then send mail using cron..
... (5 Replies)
Hi All,
I need to check for 3 conditions and if all the 3 are not satified need to say that services are not running....
is the below code correct.
#********** Check to see if Service 1 is still running**************
if
then
echo "$datetimestamp: Service1 is not running" >>... (4 Replies)
I'm working on a script for class as a final project. We have to ask for values (city, state, zip) five times, but the state can only be MI, IN, IL, or OH. I'm trying to do this with a while loop inside of a while loop, but I have no idea how to do it properly.
Here's what I have so far:
... (3 Replies)
I have the following bash code, and wondering if it is possible (and a good idea) to write the if statements in one line.
# Run raytrac on the sound speed model.
if ; then
$bashPath/raytrac.bash -fcmd=$fcmd.cmd
fi
# Plot the travel times and ray paths.
if ; then
... (8 Replies)
Hello,
I am trying to create a matrix of 0's and 1's depending on whether a gene and sample name are found in the same line in a file called results.txt. An example of the results.txt file is (tab-delimited):
Sample1 Gene1 ## Gene2 ##
Sample2 Gene2 ## Gene 4 ##
Sample3 Gene3 ... (2 Replies)
exmaple:
file1 and file2 has 1 bit
if
then
exit
else
send out email
fi
if
then
exit
else
send out email
fi
it exits the 1st if. did not continue with my 2nd if. thanks in advanced.
Please use CODE tags are suggested on every page when you post an item in... (7 Replies)
Hello,
I am new to scripting and I am trying to write a simple script that creates users and adds their passwords from two files; one a user list file and another a password list file.
For example, I have two files already.
$ cat file1
andy
stephane
aby
paul
$ cat file2
123
234... (4 Replies)
Discussion started by: FemoTheDon
4 Replies
LEARN ABOUT POSIX
libbash
LIBBASH(7) libbash Manual LIBBASH(7)NAME
libbash -- A bash shared libraries package.
DESCRIPTION
libbash is a package that enables bash dynamic-like shared libraries. Actually its a tool for managing bash scripts whose functions you may
want to load and use in scripts of your own.
It contains a 'dynamic loader' for the shared libraries ( ldbash(1)), a configuration tool (ldbashconfig(8)), and some libraries.
Using ldbash(1) you are able to load loadable bash libraries, such as getopts(1) and hashstash(1). A bash shared library that can be loaded
using
ldbash(1) must answer 4 requirments:
1. It must be installed in $LIBBASH_PREFIX/lib/bash (default is /usr/lib/bash).
2. It must contain a line that begins with '#EXPORT='. That line will contain (after the '=') a list of functions that the library
exports. I.e. all the function that will be usable after loading that library will be listed in that line.
3. It must contain a line that begins with '#REQUIRE='. That line will contain (after the '=') a list of bash libraries that are
required for our library. I.e. every bash library that is in use in our bash library must be listed there.
4. The library must be listed (For more information, see ldbashconfig(8)).
Basic guidelines for writing library of your own:
1. Be aware, that your library will be actually sourced. So, basically, it should contain (i.e define) only functions.
2. Try to declare all variables intended for internal use as local.
3. Global variables and functions that are intended for internal use (i.e are not defined in '#EXPORT=') should begin with:
__<library_name>_
For example, internal function myfoosort of hashstash library should be named as
__hashstash_myfoosort
This helps to avoid conflicts in global name space when using libraries that come from different vendors.
4. See html manual for full version of this guide.
AUTHORS
Hai Zaar <haizaar@haizaar.com>
Gil Ran <ril@ran4.net>
SEE ALSO ldbash(1), ldbashconfig(8), getopts(1), hashstash(1)colors(1)messages(1)urlcoding(1)locks(1)Linux Epoch Linux