Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Help with date command in bash shell programming Post 302310236 by amitranjansahu on Friday 24th of April 2009 06:02:46 AM
Old 04-24-2009
whats the error u r getting can you post that

as i understand you want to redirect the system date to a file.Pls Correct me if i am wrong.

in my solaris machine here is the out put of the code.

----------
amit@server11 ars/amit1 $ date | read datePurchased
amit@server11 ars/amit1 $ echo "$datePurchased"
Fri Apr 24 11:40:54 MEST 2009
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using variable with cp command in bash shell

Hi, I am trying to write script to copy some files(/ppscdr/cdrp2p/temp/) from one directory to another directory using shell script. see the script below, #!/bin/sh -f dir_name=20061105 mkdir ${dir_name} cd /ppscdr/cdrp2p/temp pwd cp p2p${dir_name}*.*... (4 Replies)
Discussion started by: maheshsri
4 Replies

2. Shell Programming and Scripting

substring command works but only in BASH shell

I am having trouble running a .sh file. The code 'x=${file_name:0:$z-11}' is giving me a bad substitution error. However when I run in BASH it works. Thing is when this goes to production the .sh will not be running in BASH. Is there a way to substring a string not in BASH or a way to invoke... (2 Replies)
Discussion started by: edwardtk11
2 Replies

3. UNIX for Dummies Questions & Answers

more command does not work in bash shell

is there a different command to display contents of a file on the output in bash shell? i tried more and it does not work. (7 Replies)
Discussion started by: npatwardhan
7 Replies

4. UNIX for Dummies Questions & Answers

unix command - bash shell

Hey all, I need to know how many lines of C code are in a source bundle. I have extracted the bundle and hence there is a big directory tree with C files everywhere. So far I have something like: find . -name "*.c" | grep \ ./*/*/*/*/*/* obviously wrong, if someone could help me out... (3 Replies)
Discussion started by: zigga15
3 Replies

5. Shell Programming and Scripting

Creating a command on a BASH shell

Hi all. Suppose I have the following function in an executable file named "HOLA": ------------------------ function hola { echo "Hola ${@}."; } ------------------------ In addition, suppose that I want to execute the file so I can input my name next to ./HOLA. I mean,... (4 Replies)
Discussion started by: hresquivelo
4 Replies

6. Shell Programming and Scripting

date command in a shell script

It's perhaps a dummy question... but I don't find my way! 1) When I put the date command in a variable, it is ok and here the code : WEEK_DAY=`date +%w` DAY=`date +%Y%m%d` echo WEEK_DAY : "$WEEK_DAY" echo DAY : "$DAY" 2) I should to get direct the date and not in a variable, like : echo... (3 Replies)
Discussion started by: hiddenshadow
3 Replies

7. Homework & Coursework Questions

Bash Shell Programming assignment.

Please take a look I am stuck on step 4 1. The problem statement, all variables and given/known data: #!/bin/bash ### ULI101 - ASSIGNMENT #2 (PART A) - DUE DATE Wed, Aug 3, 2011, before 12 midnight. ###==================================================================================== ###... (13 Replies)
Discussion started by: almirzaee
13 Replies

8. Shell Programming and Scripting

Chunks of bash shell programming

I am going to provide a chunks of codes that I do not understand. Please help with them in a layman's terms. 1) ${DEBUG:-0} -------------------------------------------------------------------------- 2) print "${1}" ... (7 Replies)
Discussion started by: lg123
7 Replies

9. UNIX for Dummies Questions & Answers

Which of the following command displays your login shell in bash shell?

Options:: A)$shell B)echo $ bash C)echo $ O D)$ O (1 Reply)
Discussion started by: raghugowda
1 Replies

10. Shell Programming and Scripting

How can I apply 'date' command to specific columns, in a BASH script?

Hi everyone, I have a situation in which I have multiple (3 at last count) date columns in a CSV file (, delim), which need to be changed from: January 1 2017 (note, no comma after day) to: YYYY-MM-DD So far, I am able to convert a date using: date --date="January 12, 1990" +%Y-%m-%d ... (7 Replies)
Discussion started by: richardsantink
7 Replies
rdate(1M)                                                 System Administration Commands                                                 rdate(1M)

NAME
rdate - set system date from a remote host SYNOPSIS
rdate hostname DESCRIPTION
rdate sets the local date and time from the hostname given as an argument. You must have the authorization solaris.system.date on the local system. Typically, rdate is used in a startup script. The inetd daemon responds to rdate requests. To enable inetd response, the lines invoking the time command in inetd.conf must not be com- mented out. USAGE
The rdate command is IPv6-enabled. See ip6(7P). ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWrcmdc | +-----------------------------+-----------------------------+ SEE ALSO
inetd(1M), inetd.conf(4), attributes(5), ip6(7P) SunOS 5.10 15 Feb 2001 rdate(1M)
All times are GMT -4. The time now is 12:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy