Sponsored Content
Full Discussion: Test command in UNIX
Top Forums Shell Programming and Scripting Test command in UNIX Post 302872301 by kmanivan82 on Friday 8th of November 2013 05:39:36 AM
Old 11-08-2013
Test command in UNIX

Hi Team,

Code:
-rwxr-xr-x    1 kmani00  system            9 Nov 08 03:29 tempfile.txt
-rwxrwxrwx    1 kmani00  devgrp            0 Nov 08 03:32 testfile.txt

by exec the following command, i did not get any output.
Code:
> test -s tempfile.txt
> a=`test -s tempfile.txt`
> echo $a

>

by exec the following command, i did not get any output.
Code:
> test -s testfile.txt
> b=`test -s testfile.txt`
> echo $b

>

Not sure how this command works. How can i test the condition.

Can anyone help me out?

Thanks
Krishna

Last edited by Scrutinizer; 11-08-2013 at 09:24 PM.. Reason: code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Unix Test

Hi, I just started studying AI at the university of amsterdam and I heard there is some basic UNIX test which is available online. Well, if any of you knows a link to that test I would truely appreciate it. Thanks a lot, L (1 Reply)
Discussion started by: L.A. BOSS
1 Replies

2. Shell Programming and Scripting

TEST command

I have been looking into searching various files to display output. The search criteria will be a month and year to output various numbers in the files. is there any way to do this with the TEST function or would it have to be another way? (4 Replies)
Discussion started by: amatuer_lee_3
4 Replies

3. Shell Programming and Scripting

Help with test command

Plese help me on the below query. for j in *.20071231* *.ctl *.dat do ( if then cp "$base/*.*" "$base1" fi ) done My requirement is for all files that has extension *.20071231* *.ctl *.dat should be copied to another folder. But those with caaa.20071231.log... (7 Replies)
Discussion started by: sussane
7 Replies

4. Programming

Test command name

I'm very new to C and could use a little help. I'm testing to make sure the command is running as it's proper name, if not then fail. if (strcmp(argv, "xinit") != 0) { fprintf(stdout, "name = %s length = %d\n",argv,l); usage(0); } This works if the command is... (3 Replies)
Discussion started by: nck
3 Replies

5. UNIX for Dummies Questions & Answers

Unix grep/test command

Hello, i have a script which checks if the user entered 8 numeric characters in the form of YYYYMMDD (birth date). If the user entered any non numeric characters, an error will be displayed: # Check to see if the 8 characters are all numbers # If not show error essage # And prompt user... (4 Replies)
Discussion started by: netmaster
4 Replies

6. Shell Programming and Scripting

Test on string containing spacewhile test 1 -eq 1 do read a $a if test $a = quitC then break fi d

This is the code: while test 1 -eq 1 do read a $a if test $a = stop then break fi done I read a command on every loop an execute it. I check if the string equals the word stop to end the loop,but it say that I gave too many arguments to test. For example echo hello. Now the... (1 Reply)
Discussion started by: Max89
1 Replies

7. Shell Programming and Scripting

How to check weather a string is like test* or test* ot *test* in if condition

How to check weather a string is like test* or test* ot *test* in if condition (5 Replies)
Discussion started by: johnjerome
5 Replies

8. Shell Programming and Scripting

TEST Command

Hello, I need help with a test command. Here is what I am trying to do : I've got an interactive script that check if configuration files exist on 2 different directories, then all configuration files are print on screen by a short name. My problem is when you type a "wrong name" or... (12 Replies)
Discussion started by: Aswex
12 Replies

9. Shell Programming and Scripting

Ksh: Test UNIX command without $? everytime

Hello all, working on Solaris 10 in ksh. Basicly, in my function, i'm trying to test that all my unix cmd's are true (exit status 0) else you flag the rcControlRule to 1 without going into spagetti mode code testing every $? in a if statement. The mdb is probably a little tricky cause it... (3 Replies)
Discussion started by: maverick72
3 Replies

10. UNIX for Beginners Questions & Answers

Help with UNIX test and wc Command

I want to xheck if a file exists that uses wildcards as only the partial filename is known using the test Command, and when it exists then output just the number of lines in the file... do not include the filename. Then this output, is it captured by the CommandOutput or the ReturnValue as I want... (2 Replies)
Discussion started by: dsinco
2 Replies
unix2dos(1)						      General Commands Manual						       unix2dos(1)

NAME
unix2dos - UNIX to DOS text file format converter SYNOPSYS
unix2dos [options] [-c convmode] [-o file ...] [-n infile outfile ...] Options: [-hkqV] [--help] [--keepdate] [--quiet] [--version] DESCRIPTION
This manual page documents unix2dos, the program that converts text files in UNIX format to DOS format. OPTIONS
The following options are available: -h --help Print online help. -k --keepdate Keep the date stamp of output file same as input file. -q --quiet Quiet mode. Suppress all warning and messages. -V --version Prints version information. -c --convmode convmode Sets conversion mode. Simulates unix2dos under SunOS. -o --oldfile file ... Old file mode. Convert the file and write output to it. The program default to run in this mode. Wildcard names may be used. -n --newfile infile outfile ... New file mode. Convert the infile and write output to outfile. File names must be given in pairs and wildcard names should NOT be used or you WILL lost your files. EXAMPLES
Get input from stdin and write output to stdout. unix2dos Convert and replace a.txt. Convert and replace b.txt. unix2dos a.txt b.txt unix2dos -o a.txt b.txt Convert and replace a.txt in ASCII conversion mode. Convert and replace b.txt in ISO conversion mode. unix2dos a.txt -c iso b.txt unix2dos -c ascii a.txt -c iso b.txt Convert and replace a.txt while keeping original date stamp. unix2dos -k a.txt unix2dos -k -o a.txt Convert a.txt and write to e.txt. unix2dos -n a.txt e.txt Convert a.txt and write to e.txt, keep date stamp of e.txt same as a.txt. unix2dos -k -n a.txt e.txt Convert and replace a.txt. Convert b.txt and write to e.txt. unix2dos a.txt -n b.txt e.txt unix2dos -o a.txt -n b.txt e.txt Convert c.txt and write to e.txt. Convert and replace a.txt. Convert and replace b.txt. Convert d.txt and write to f.txt. unix2dos -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt DIAGNOSTICS
BUGS
The program does not work properly under MSDOS in stdio processing mode. If you know why is that so, please tell me. AUTHOR
Benjamin Lin - ( blin@socs.uts.edu.au ) MISCELLANY
Tested environment: Linux 1.2.0 with GNU C 2.5.8 SunOS 4.1.3 with GNU C 2.6.3 MS-DOS 6.20 with Borland C++ 4.02 Suggestions and bug reports are welcome. SEE ALSO
dos2unix(1) 1995.03.31 unix2dos v2.2 unix2dos(1)
All times are GMT -4. The time now is 11:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy