Sponsored Content
Full Discussion: Not getting expected output
Top Forums Shell Programming and Scripting Not getting expected output Post 302752457 by scriptor on Monday 7th of January 2013 03:59:34 AM
Old 01-07-2013
Not getting expected output

Hi

I have written below script to get the data in table form.
Code:
#!/bin/sh
echo "File Name\tType"
for i in *;
do
echo "$i\t\c"
if [ -d $i ]; then
echo "directory"
elif [ -h $i ]; then
echo "symbolic link"
elif [ -f $i ]; then
echo "file"
else
echo "unknown"
fi
done

however i am getting output in different way . pls see below
Code:
sel1 \t\c
file
t1 \t\c
file
t1.txt \t\c
file
test \t\c
file
test1 \t\c
file
true.tar \t\c
file
vk \t\c
directory

i also noticed that the command
Code:
echo "File Name\tType"

is not working properly in script but when i run this separately it is working fine .
Code:
$ echo "File Name\tType"
File Name       Type
$

i am using ksh shell

regards,
Scriptor
 

10 More Discussions You Might Find Interesting

1. Programming

[C language] system function print output when not expected.

Hi, I am new to C and have a little problem. I am not planning to be a C expert, but this would be nice to understand. The problem is that a 'system' call prints it output to stdout, when I do not expect this. This is the program: trial.c #include <ctype.h> #include <unistd.h>... (5 Replies)
Discussion started by: ejdv
5 Replies

2. Shell Programming and Scripting

awk not generating the expected output

Hi, I am presently stuck in a csv file. INPUT CSV baseball,NULL,8798765,Most played baseball,NULL,8928192,Most played baseball,NULL,5678945,Most played cricket,NOTNULL,125782,Usually played cricket,NOTNULL,678921,Usually played EXPECTED OUTPUT CSV ... (7 Replies)
Discussion started by: scripter12
7 Replies

3. Shell Programming and Scripting

Output is not comming as expected

Hi All, I am in middle of one script. I want output in the form of xls file. There are 4 fields - user name, email Id, full name, date of birth. I want these details to get in seperate columns. But, i am getting it in the single cell and as like a paragraph.:mad: Please suggest me some... (8 Replies)
Discussion started by: Agupte
8 Replies

4. Shell Programming and Scripting

Trying to learn to use functions in gawk and not getting expected output.

I've been working on improving my awk, and the next thing I want to learn is to properly use functions (I understand functions in shell and python). I have the following code which includes how I did this without functions before, and two attempts I've made to do it with functions: function... (3 Replies)
Discussion started by: DeCoTwc
3 Replies

5. Shell Programming and Scripting

Grep can't match expected but output all

lyang001@lyang001-OptiPlex-9010:~$ service --status-all |grep dbus acpid acpi-support alsa-restore alsa-store anacron apport atd avahi-daemon bluetooth cgroup-lite console-setup cron cups dbus dmesg dns-clean failsafe-x ... (1 Reply)
Discussion started by: yanglei_fage
1 Replies

6. Shell Programming and Scripting

awk output not what was expected

Good Moring, I am currently reading about awk in a manual and following the examples using the oratab file. My system is SOLARIS 10 I think I am getting strange behavior judging by what the book says to do and what I am getting with my little program. Here is my program: grep -v oratab |... (4 Replies)
Discussion started by: bdby
4 Replies

7. Shell Programming and Scripting

For loop not giving expected output

#cat /tmp/input old_array old_dev new_dev new_array 0577 008AB 01744 0125 0577 008AC 01745 0125 0577 008AD 005C8 0125 0577 008AE 005C9 0125 0577 008AF 005CA 0125 0577 008B0 005CB 0125 0577 008B1 005CC 0125 cat test.sh #!/bin/ksh... (4 Replies)
Discussion started by: mbak
4 Replies

8. Shell Programming and Scripting

Assigning variable to output gives error with expected result

Hello, I am trying to print out the first string matching query with grep and I need your help. My scenario: Database John F 4433 Street No 88 CA Elisabeth Taylor 7733 Street No 26 ON Jack Nicholson 0133 Green Park No 34 AR John F 2 9399 Southpark No 02D UT test.sh... (6 Replies)
Discussion started by: baris35
6 Replies

9. Shell Programming and Scripting

awk not giving the output expected

Hello, I am practising awk and decided to compare two columns and print the result of the comparison as third column i/p data c1,c2,c3 1,a,b 1,b,b i am trying to compare the last two columns and if they match I am trying to print match else mismatch(Ideally i want that as a last column... (5 Replies)
Discussion started by: mkathi
5 Replies

10. Shell Programming and Scripting

Grep output to file result not as expected

Hi Gurus, I run command grep ABC file1 > file2 against below file. I got all ABC_xxx in one line in file2. I expect to get multiple lines in file2. If I print result in screen, the result is expected. thanks in advance My os is SunOS 5.10 Generic_150400-64 sun4v sparc sun4v ABC_123 XXXXX... (2 Replies)
Discussion started by: green_k
2 Replies
Plack::Session::Store::File(3pm)			User Contributed Perl Documentation			  Plack::Session::Store::File(3pm)

NAME
Plack::Session::Store::File - Basic file-based session store SYNOPSIS
use Plack::Builder; use Plack::Middleware::Session; use Plack::Session::Store::File; my $app = sub { return [ 200, [ 'Content-Type' => 'text/plain' ], [ 'Hello Foo' ] ]; }; builder { enable 'Session', store => Plack::Session::Store::File->new( dir => '/path/to/sessions' ); $app; }; # with custom serializer/deserializer builder { enable 'Session', store => Plack::Session::Store::File->new( dir => '/path/to/sessions', # YAML takes it's args the opposite order serializer => sub { YAML::DumpFile( reverse @_ ) }, deserializer => sub { YAML::LoadFile( @_ ) }, ); $app; }; DESCRIPTION
This implements a basic file based storage for session data. By default it will use Storable to serialize and deserialize the data, but this can be configured easily. This is a subclass of Plack::Session::Store and implements its full interface. METHODS
new ( %params ) The %params can include dir, serializer and deserializer options. It will check to be sure that the dir is writable for you. dir This is the directory to store the session data files in, if nothing is provided then "/tmp" is used. serializer This is a CODE reference that implements the serialization logic. The CODE ref gets two arguments, the $value, which is a HASH reference to be serialized, and the $file_path to save it to. It is not expected to return anything. deserializer This is a CODE reference that implements the deserialization logic. The CODE ref gets one argument, the $file_path to load the data from. It is expected to return a HASH reference. BUGS
All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to cpan-RT. AUTHOR
Stevan Little <stevan.little@iinteractive.com> COPYRIGHT AND LICENSE
Copyright 2009, 2010 Infinity Interactive, Inc. <http://www.iinteractive.com> This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.4 2011-07-27 Plack::Session::Store::File(3pm)
All times are GMT -4. The time now is 07:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy