Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Getting error while using date as a variable in expect Post 303021330 by scriptor on Wednesday 8th of August 2018 06:46:08 AM
Old 08-08-2018
Hi Andrew,
yes the path is same when I run manually or when it runs from cron.


below error I get when script run from cron


Code:
# log
+ log
spawn sftp AUT@xx.xx.xx.xx
Connecting to xx.xx.xx.xx...
AUT@xx.xx.xx.xx's password: 
sftp> cd /home 
sftp> put LOGS_2018-08-08.tar.gz
stat LOGS_2018-08-08.tar.gz: No such file or directory


Last edited by scriptor; 08-08-2018 at 07:46 AM.. Reason: typo
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to check date variable according to the current date?

Hi folks, I need to write a script that should activate a process according to the current hour. The process should be activatet only if the hour is between midnight (00:00) and 07:00. How should I create the condition? Thanks in advance, Nir (2 Replies)
Discussion started by: nir_s
2 Replies

2. Shell Programming and Scripting

Transfer variable to an expect function

Hi There, I try to transfer a variable from the script to a function which use expect, but I don't succed. #!/bin/sh HPPASS1="$2" send_command() { echo "spawn ssh login@10.10.10.10" echo 'set password ' echo 'sleep 1' echo 'expect "*assword:*"'... (5 Replies)
Discussion started by: sylvainkalache
5 Replies

3. Shell Programming and Scripting

passing variable to expect

Please tell me how to pass variable "a b c" to expect from the shell script 1/ example of input file # cat in-file var1 var2 a b c var4 2/ # this is my script - how to pass "a b c" as single variable ? cat in-file | while read x do my-expect x done 3/ # expect script - how to... (0 Replies)
Discussion started by: breaktime123
0 Replies

4. Shell Programming and Scripting

Assigning last line to variable in expect

As part of an expect script, I have to convert a strange user ID to a conventional UNIX ID. To do this, I read the contents of a file and do a little awk magic. Here's that bit of the expect script: send "awk 'NF == 10 && \$NF == strange_user_id {print \$(NF-2)}' file_with_my_info\r" expect... (0 Replies)
Discussion started by: treesloth
0 Replies

5. Shell Programming and Scripting

How to pass variable with spaces from shell to expect?

I need call expect script from shell script and pass values some of which could contain space. How to make expect to treat such values as one variable? (1 Reply)
Discussion started by: urello
1 Replies

6. Shell Programming and Scripting

LINUX ---> Add one date to a date variable

Hi All, I am trying to add one day to the busdt variable i am extracting from a file (DynamicParam.env). I am deriving the busdt as below. Is there any function which I can use to derive as below. If busdt=20120910, then the new derived variable value should be 20120911 If... (2 Replies)
Discussion started by: dsfreddie
2 Replies

7. Shell Programming and Scripting

Python get the expect value from a variable

the value of the variable is yes group=bsp_16 keyword="82599" test_var="-a xxx -b yyy" I want to get output with -a xxx -b yyy (0 Replies)
Discussion started by: yanglei_fage
0 Replies

8. Shell Programming and Scripting

Convert a date stored in a variable to epoch date

I am not able to pass date stored in a variable as an argument to date command. I get current date value for from_date and to_date #!/usr/bin/ksh set -x for s in server ; do ssh -T $s <<-EOF from_date="12-Jan-2015 12:02:09" to_date="24-Jan-2015 13:02:09" echo \$from_date echo... (7 Replies)
Discussion started by: raj48
7 Replies

9. Shell Programming and Scripting

Expect Redirecting o/p to an Variable

I have a password reset expect script which stores all the op to an file. I need to check the whether password is successfully changed by greping out the file and storing the o/p to a variable. But we try to print the variable , its shows only the command instead of its o/p. ... (2 Replies)
Discussion started by: sudharson
2 Replies

10. UNIX for Beginners Questions & Answers

How to replace a parameter(variable) date value inside a text files daily with current date?

Hello All, we what we call a parameter file (.txt) where my application read dynamic values when the job is triggered, one of such values are below: abc.txt ------------------ line1 line2 line3 $$EDWS_DATE_INSERT=08-27-2019 line4 $$EDWS_PREV_DATE_INSERT=08-26-2019 I am trying to... (1 Reply)
Discussion started by: pradeepp
1 Replies
DATE(1) 							   User Commands							   DATE(1)

NAME
date - print or set the system date and time SYNOPSIS
date [OPTION]... [+FORMAT] date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]] DESCRIPTION
Display the current time in the given FORMAT, or set the system date. -d, --date=STRING display time described by STRING, not `now' -f, --file=DATEFILE like --date once for each line of DATEFILE -ITIMESPEC, --iso-8601[=TIMESPEC] output date/time in ISO 8601 format. TIMESPEC=`date' for date only, `hours', `minutes', or `seconds' for date and time to the indi- cated precision. --iso-8601 without TIMESPEC defaults to `date'. -r, --reference=FILE display the last modification time of FILE -R, --rfc-822 output RFC-822 compliant date string -s, --set=STRING set time described by STRING -u, --utc, --universal print or set Coordinated Universal Time --help display this help and exit --version output version information and exit FORMAT controls the output. The only valid option for the second form specifies Coordinated Universal Time. Interpreted sequences are: %% a literal % %a locale's abbreviated weekday name (Sun..Sat) %A locale's full weekday name, variable length (Sunday..Saturday) %b locale's abbreviated month name (Jan..Dec) %B locale's full month name, variable length (January..December) %c locale's date and time (Sat Nov 04 12:02:33 EST 1989) %C century (year divided by 100 and truncated to an integer) [00-99] %d day of month (01..31) %D date (mm/dd/yy) %e day of month, blank padded ( 1..31) %F same as %Y-%m-%d %g the 2-digit year corresponding to the %V week number %G the 4-digit year corresponding to the %V week number %h same as %b %H hour (00..23) %I hour (01..12) %j day of year (001..366) %k hour ( 0..23) %l hour ( 1..12) %m month (01..12) %M minute (00..59) %n a newline %N nanoseconds (000000000..999999999) %p locale's upper case AM or PM indicator (blank in many locales) %P locale's lower case am or pm indicator (blank in many locales) %r time, 12-hour (hh:mm:ss [AP]M) %R time, 24-hour (hh:mm) %s seconds since `00:00:00 1970-01-01 UTC' (a GNU extension) %S second (00..60); the 60 is necessary to accommodate a leap second %t a horizontal tab %T time, 24-hour (hh:mm:ss) %u day of week (1..7); 1 represents Monday %U week number of year with Sunday as first day of week (00..53) %V week number of year with Monday as first day of week (01..53) %w day of week (0..6); 0 represents Sunday %W week number of year with Monday as first day of week (00..53) %x locale's date representation (mm/dd/yy) %X locale's time representation (%H:%M:%S) %y last two digits of year (00..99) %Y year (1970...) %z RFC-822 style numeric timezone (-0500) (a nonstandard extension) %Z time zone (e.g., EDT), or nothing if no time zone is determinable By default, date pads numeric fields with zeroes. GNU date recognizes the following modifiers between `%' and a numeric directive. `-' (hyphen) do not pad the field `_' (underscore) pad the field with spaces ENVIRONMENT
TZ Specifies the timezone, unless overridden by command line parameters. If neither is specified, the setting from /etc/localtime is used. AUTHOR
Written by David MacKenzie. REPORTING BUGS
Report bugs to <bug-coreutils@gnu.org>. COPYRIGHT
Copyright (C) 2002 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU- LAR PURPOSE. SEE ALSO
The full documentation for date is maintained as a Texinfo manual. If the info and date programs are properly installed at your site, the command info date should give you access to the complete manual. date (coreutils) 4.5.3 October 2002 DATE(1)
All times are GMT -4. The time now is 12:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy