du command error in ksh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting du command error in ksh
# 1  
Old 10-16-2008
du command error in ksh

Hi,

i am facing an error in the korn shell by executing the following script, can anyone help me out in solving the error..


Note: /root/kamal is a directory

size_dir=$(du -s /root/kamal | cut -f1)
echo $size_dir

error: invalid $ at ( in size_dir

Thanks & regards
kamal
# 2  
Old 10-16-2008
Quote:
Originally Posted by G.K.K
Hi All,

i am facing an error in the korn shell by executing the following script, can anyone help me out in solving the error..
The script is to find the size of a directory.......

Note: /root/kamal is a directory

size_dir=$(du -s /root/kamal | cut -f1)
echo $size_dir

error: invalid $ at ( in size_dir

please help me in solving this, it would be greateful for me if any one help me in solving this..

Thanks & regards
kamal
please help me in solving this...
# 3  
Old 10-16-2008
Java

Not sure about why it is throwing error for you. Try this one:
Code:
size_dir=`du -s /root/kamal | cut -f1`
echo $size_dir

Regards
Dileep
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using awk command in ksh

I am trying to use awk command withing ksh. ksh "echo \"my name\" | awk '{print $2}'" I am getting out as : my name Expected output: name When I use echo "my name" | awk '{print $2}' I am getting the correct output: name I am not sure what mistake I am doing when using awk... (1 Reply)
Discussion started by: Bala_db2
1 Replies

2. Shell Programming and Scripting

command timeout in ksh

I probably read all the threads in almost all the forums for a solution to my need. I am a beginner in shell scripting and I dont have a perfect solution yet. Below is my code snippet. idql -n $REPOSITORY_NAME.$cs -Udmadmin -P"" -R$DM_SCRIPTS/test.api > /dev/null 2>&1 if ; then echo... (7 Replies)
Discussion started by: vishnudev1
7 Replies

3. Shell Programming and Scripting

ksh - find command with 2 actions attached and error logging

Hi there, I'm encountering problems on an AIX system when using following in my script. find . -name *.edi -type f -exec sh -c 'scp {} $user@$server:$path || exit 5; mv {} $sent || exit 7' \; the error i get is following find: 0652-018 An expression term lacks a required... (4 Replies)
Discussion started by: Kerberos
4 Replies

4. Shell Programming and Scripting

rsh command - ksh

Hello, I am trying to run a remote file (y.ksh) using rsh. In this action i want to use an environment variable TOOL=/home/macc1 i am running the rsh from profile macc on server1. rsh server2 -l macc1 "$TOOL/y.ksh" but i can see that the executable command = /home/macc/y.ksh and not... (1 Reply)
Discussion started by: LiorAmitai
1 Replies

5. Shell Programming and Scripting

Receiving error: ./ang.ksh[35]: 0403-057 Syntax error at line 116 : `done' is not expected.

Hi All I am quite new to Unix. Following is a shell script that i have written and getting the subject mentioned error. #!/bin/ksh #------------------------------------------------------------------------- # File: ang_stdnld.ksh # # Desc: UNIX shell script to extract Store information.... (3 Replies)
Discussion started by: amitsinha
3 Replies

6. Shell Programming and Scripting

awk/sed Command : Parse parameter file / send the lines to the ksh export command

Sorry for the duplicate thread this one is similar to the one in https://www.unix.com/shell-programming-scripting/88132-awk-sed-script-read-values-parameter-files.html#post302255121 Since there were no responses on the parent thread since it got resolved partially i thought to open the new... (4 Replies)
Discussion started by: rajan_san
4 Replies

7. Shell Programming and Scripting

In ksh shell command - Print "-ABC" is giving error

Hi Guys, while executing the following command : print "-ABC" is giving following error : ksh: print: bad option(s) I cannot use echo for some other reasons, so any other option ? (2 Replies)
Discussion started by: sagarjani
2 Replies

8. Shell Programming and Scripting

ssh command in ksh script encounters permission error

I've created a script and copied it to another server and try to execute it at the same time but I'm getting a permission error. I'm logged on as root and I gave the file 777 permission when I created it, but I can't run it remotely via ssh command because of permission issue. Any ideas? ... (5 Replies)
Discussion started by: pdtak
5 Replies

9. UNIX for Dummies Questions & Answers

ksh with bc command error

Hi, I don't understand why the below code gave me error message: worked: not found I am using ksh program. worked =`/usr/ucb/echo "scale=2; ($logend-$logstart)/3600" | bc` Thank you very much for your help! (1 Reply)
Discussion started by: cin2000
1 Replies

10. Shell Programming and Scripting

printf command in ksh

Hi, I am very confused with my printf command. Somehow one variable can't line up with others... newstart2 ="Mon Nov 11 01 00:00:00 2002" printf "%-20s" $newstart2 Here is the output: Mon Nov 11 01 00:00:00 2002 It spread out to two lines.. Why? (1 Reply)
Discussion started by: cin2000
1 Replies
Login or Register to Ask a Question