LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-10-2014, 01:01 AM   #1
sagar666
Member
 
Registered: Feb 2013
Posts: 212

Rep: Reputation: Disabled
script error


i have file in /code/output/test
team=test
wc -l /code/output/$team

getting no file or directory
 
Old 01-10-2014, 02:07 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Quote:
Originally Posted by sagar666 View Post
i have file in /code/output/test
team=test
wc -l /code/output/$team

getting no file or directory
The above should work.

Can you post the complete error message?
 
Old 01-10-2014, 03:15 AM   #3
sagar666
Member
 
Registered: Feb 2013
Posts: 212

Original Poster
Rep: Reputation: Disabled
my output

[root@b16-sn-qa-042 output]# team=test
[root@b16-sn-qa-042 output]# vim test
[root@b16-sn-qa-042 output]# wc -l /code/output/$test
wc: /code/output/: Is a directory
0 /code/output/
[root@b16-sn-qa-042 output]#
 
Old 01-10-2014, 03:21 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Quote:
Originally Posted by sagar666 View Post
my output

[root@b16-sn-qa-042 output]# team=test
[root@b16-sn-qa-042 output]# vim test
[root@b16-sn-qa-042 output]# wc -l /code/output/$test
wc: /code/output/: Is a directory
0 /code/output/
[root@b16-sn-qa-042 output]#
3 things I notice:

1 - What is the meaning of the blue line?
2 - The bold part shows that wc is looking for /code/output/ and not /code/output/test (test is empty, see next remark)
3 - You do team=test, but are using $test. Shouldn't that be $team?
 
Old 01-10-2014, 04:40 AM   #5
sagar666
Member
 
Registered: Feb 2013
Posts: 212

Original Poster
Rep: Reputation: Disabled
Hi druuna

No idea why blue and bold .....it is not comming in my output ......may be here is problem when i post this tread.

what i require is team=test
vim test
Is there any way to see the output by using team instead of test
why because i dont want to see output like this wc -l /code/output/test

---------- Post added 01-10-14 at 05:40 AM ----------

Hi druuna

No idea why blue and bold .....it is not comming in my output ......may be here is problem when i post this tread.

what i require is team=test
vim test
Is there any way to see the output by using team instead of test
why because i dont want to see output like this wc -l /code/output/test
 
Old 01-10-2014, 04:50 AM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
You lost me with your previous reply.

Your original question:
Quote:
Originally Posted by sagar666 View Post
i have file in /code/output/test
team=test
wc -l /code/output/$team

getting no file or directory
That should work.

Your post after I asked for the complete error message:
Quote:
Originally Posted by sagar666 View Post
my output

[root@b16-sn-qa-042 output]# team=test
[root@b16-sn-qa-042 output]# vim test
[root@b16-sn-qa-042 output]# wc -l /code/output/$test
wc: /code/output/: Is a directory
0 /code/output/
[root@b16-sn-qa-042 output]#
The 2 examples aren't the same.

In the first one you do
Code:
team=test
wc -l /code/output/$team
in the second you do:
Code:
team=test
wc -l /code/output/$test
The second one will not work, the red part should be $team

In your latest reply you ask this:
Quote:
Originally Posted by sagar666 View Post
what i require is team=test
vim test
Is there any way to see the output by using team instead of test
why because i dont want to see output like this wc -l /code/output/test
I assuming you want to do the following:
Code:
$ team=test
$ cat $team
# or
$ vi $team
 
Old 01-10-2014, 05:05 AM   #7
sagar666
Member
 
Registered: Feb 2013
Posts: 212

Original Poster
Rep: Reputation: Disabled
Sorry druuna i confused u lot thanks for ur reply.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
script.pl with sed shell calls: sh error syntax error near unexpected token `(' MMaddoxx Programming 7 11-24-2011 08:00 AM
why am getting error ksh: syntax error: `fi' unexpected while running script deb4you Linux - Newbie 4 09-06-2008 08:37 AM
i get an error message running php script inside a cgi script. repolona Linux - Software 0 02-22-2007 09:10 PM
error when tying to run python script(bash error?) shanenin Programming 5 01-10-2006 10:01 AM
linux 9 and java script error - premature end of script header sibil Linux - Newbie 0 01-06-2004 04:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration