Question about syntax error

first of all.. sorry about all the question bombing.. im bored atm so im currently playing around with sh scripting hehe

s = `expr ls -s Documents | grep Music | awk '{ print $1 }' `    
t = `expr $t + $s`

it give syntax error
s not found
t not found lol...
any idea why?

Remove the spaces in the assignments:

s=something

u mean?

s=`expr ls -s Documents | grep Music | awk '{print $1}' `    

doesnt work too.. i even tried {Documents} {Music}
none work

---------- Post updated at 12:04 PM ---------- Previous update was at 12:03 PM ----------

maybe expr doesnt work with that? cause i tried

ls -s Documents | grep Music | awk '{print $1}'

it does give the result... just the s doesnt record it

You don't need expr for that, just backticks or $(...).

s=$(ls -s Documents | grep Music | awk '{print $1}')

bracket doesn't work, maybe cause it's sh? but backticks work
not on this (below)
i though this is suppose to work? judging from http://cis.stvincent.edu/html/tutorials/unix/bshellref
i'm learning about sh from there

t=`expr $t + $s`
it gives me syntax error

Hello,

Per our forum rules, all users must write in English, use semi-formal or formal English language and style, and correct spelling errors.

The reason for this is that most software and operating systems are written in English and these are software related technical forums.

In addition, nearly 95% of all visitors to this site come here because they are referred by a search engine. In order for future searches on your post (with answers) to work well, you need to spell correctly!

So, as a benefit and courtesy to current and future knowledge seekers, please be careful with your language, check your spelling and correct your spelling errors. You might receive a forum infraction if you don't pay attention to this.

Also, do not write in cyberpunk or abbreviated chat style under any circumstances and do not use profanity. This is not a chat room, it is a formal knowledge base to serve you and everyone, of all ages and cultural backgrounds.

Thanks!

The UNIX and Linux Forums

That is Bourne Shell, hardly any system uses that nowadays. On most systems /bin/sh stands for a POSIX shell, in which $( ) does work. A modern day exception is Solaris, where /bin/sh is in fact still a Bourne Shell, but it also has /usr/xpg4/bin/sh which is a POSIX compliant shell..

i see so that's why brackets doesn't work but

t=`expr $t + $s`

should work on bourne too right?

---------- Post updated at 12:45 PM ---------- Previous update was at 12:43 PM ----------

oh i get it, forgot to assign variables ... that's why

---------- Post updated at 12:46 PM ---------- Previous update was at 12:45 PM ----------

Thanks again for your help Carlom and Scrutinizer