Hi
I have created a function in a Shell Script test.sh
Code:
function fnTest()
{
echo "My first Method
}
I have called this function in my test.sh
Code:
cat abc.txt | grep "test"
echo " test"
fnTest
But while running the shell script i got the following error:
./test.sh: line 5: fnTest: command not found
Well, this is a very crazy issue, and I'm scratching my head to find a solution.
This is a simple code to tranfer a file, in my main script I need to add a conditional statement (IF/THEN) like the below example:
Code:
#!/bin/bash
if [ 10 -gt 0 ]; then
ftp -inv "192.168.1.10" << EOFTP
user "username" "password"
put app.log
Hi
I have a bash script which takes parameters
Code:
sh /tmp/gdg.sh -b BASE-NAME -n 1 -s /source/data -p /dest/data/archive -m ARC
gdg.sh will scan the /source/data and will move the contents to /dest/data/archive after passing through some filters.
First I write a configfile with all my parameters like this
path="/home/test/"
I name it test.conf.
Then I write a shell script with this content, name it test, and make it executable with chmod +x.
#!/bin/bash
#read the config file
.
I have the following bash script lines in a file named test.sh.
Code:
#!/bin/bash
#
# Write Date to cron.log
#
echo "Begin SSI Load $(date +%d%b%y_%T)"
#
# Get the latest rates file for processing.
#
d=$(ls -tr /rms/data/ssi | grep -v "processed" | tail -n 1)
filename=$d
export filename
echo "The file name is $filename."
When I execute ./test.sh
1. The problem statement, all variables and given/known data:
Problem 1:
I need to create a shell script the takes three arguments and echo's out "There once was a ____that____who like to_____"
The arguments go where the blanks are.
Problemt 2:
-Do an LS and store the listings in a file
-Open the file in emacs.
Hello I'm very new to Linux and shell scripting so I only know basic stuff. I'm making a script with the purpose of finding the longest string or word in a file.
Hi, doing exercises in A Practical Guide to Linux Commands, Editors, and Shell Programming by Mark G. Sobell. One of the exercises involves a script that is passed in the name of an environment variable.
So lets say I have an environment variable $test that I exported with value "testing".
So lets say the script is named foobar, and is invoked:
I am trying to make a script that will execute different things by the input
Input:
Code:
#/bin/bash
echo "Test script"
read cake
if [ "$cake" == "1" ]
then
echo "cake it is"
fi
Output:
Code:
1
: bad variable nameake
test.sh: 8: test.sh: Syntax error: end of file unexpected (expecting "then")