10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have this code
#!/bin/bash
LZ () {
RETVAL="\n$(date +%Y-%m-%d_%H-%M-%S) --- "
return RETVAL
}
echo -e $LZ"Test"
sleep 3
echo -e $LZ"Test"
which I want to use to make logentrys on my NAS. I expect of this code that there would be output like
2017-03-07_11-00-00 --- Test (4 Replies)
Discussion started by: matrois
4 Replies
2. Shell Programming and Scripting
Hi,
I'm playing with ksh. I'm trying to do a simple task:
read file name from cli and call a function which calculated number of lines in file.
I'm getting coredump every time when I try to read that file.
Korn shell version
$ print ${.sh.version}
Version AJM 93u+ 2012-08-01
Main... (5 Replies)
Discussion started by: solaris_user
5 Replies
3. Shell Programming and Scripting
hey guys, im trying to learn bourne shell atm and I'm having some issues with functions.
so heres my code:
#!/bin/bash
##functions
memory () {
free -m
}
space () {
df -h
}
ip () { (5 Replies)
Discussion started by: hawkfro12
5 Replies
4. Shell Programming and Scripting
Hi,
I had a scripts which calls two function. One function will call another function, script is working fine but the second function is not calling the first function. Below is the script
#!/usr/bin/ksh
fun1() {
echo $DATETIME >> Test1.ksh
return 0
}
fun2() {
typeset DATETIME=`date... (5 Replies)
Discussion started by: somu_june
5 Replies
5. Shell Programming and Scripting
Hi All,
I am using splice function in for loop to delete particular element from array with one condition.
my $cnt=0;
foreach my $elem (@result)
{
if (condition){
splice(@result, $cnt, 1);}
else{
$cnt++;}
}
Now when in array, two elements comes sequentially with the... (3 Replies)
Discussion started by: gentleDean
3 Replies
6. Shell Programming and Scripting
Hi All,
I have a function which reads parameter and gets the value from config file.
The entry in the file can be either of two
Name=value or
Name=value
so if the variant is not present it should return me the generic value ie Name without variant.
I am first searching for variant in... (4 Replies)
Discussion started by: gurukottur
4 Replies
7. Shell Programming and Scripting
Need an extra set of eyes. Can't find function. Can someone help, please. Thanks
echo " Is this the correct list of tapes to eject (y/n)?"
read option
echo $option
case $option in
y|Y) TAPE_ROUTINE;;
... (3 Replies)
Discussion started by: gzs553
3 Replies
8. Shell Programming and Scripting
Hi all,
I have to move all the files in a tree directory structure to a single directory. Inorder to know which file is from which directory , i'll have to add the name of the directory to the file name. For this i wrote a recursive function which is as follows... (4 Replies)
Discussion started by: malle
4 Replies
9. Shell Programming and Scripting
I have perl script as follow.
------------------------------------------------------------------------
#! /usr/bin/env perl
use strict;
sub printLines
{
print "Inside the function.............\n";
my (@file , $count , $key ) = $_;
print $count , $ key ; #... (2 Replies)
Discussion started by: avadhani
2 Replies
10. Programming
Hi folks,
I'm trying to make a reconnection algorithm using rexec(), but I noticed that when rexec() fails returning -1, it is impossible to make it run successfully again until you restart the program or the thread.
Example, I have a endless loop for connection retries, if I supply a wrong... (7 Replies)
Discussion started by: lcmoreno
7 Replies