Sponsored Content
Top Forums Shell Programming and Scripting There's a unknown command on line 1 and i don't know whats causing it. Post 302839211 by thatguy565 on Wednesday 31st of July 2013 06:13:45 PM
Old 07-31-2013
There's a unknown command on line 1 and i don't know whats causing it.

My OS is Linux GL version 2.4.26. I am trying to make a shell script that outputs a chart displaying info of who is online, boot time, and the real time, I have manage to get it to work, but I still get the error "./user/script: line 1: : command not found." I do in fact have access to root, if that makes any difference. Although i do expect this to be either something i did wrong but just don't understand, or a bug in the Linux system.

Code:
#!/bin/bash

# it looks ugly without a clear... sooooo

clear

# This section is the time determining section

# the time command

tme=$(date);

# This is the system boot time determining section

# command for looking at boot time

boot=$(who -b);

# This section is the Users online determining section


# setting w and its arguments

wr=$(w -h root);
wg=$(w -h glucero565);
wa=$(w -h alucero565);

# determining weither or not root is logged in

if [ "$wr" != "" ]
	then
		line1=$(w -h root);
	else
		line1=$("");
fi

# determining weither or not glucero565 is logged in

if [ "$wg" != "" ]
	then
		line2=$(w -h glucero565);
	else
		line2=$("");
fi

# determining weither or not alucero565 is loggin in

if [ "$wa" != "" ]
	then
		line3=$(w -h alucero565);
	else
		line3=$("");
fi

# inserting parts of the chart

echo "                                   Info                                            "
echo "+---------------------------------------------------------------------------------+"
echo "|                                                                                 |"

# inserting current time here

echo "|                           $tme                          |"

# inserting boot time here

echo "|                  $boot                             |"

# determining what to put in the first line of the User section of the chart

if [ "$line1" == "" ]
	then
		echo "|                                                                                 |"
	else
		echo "| $line1 |"
fi

# determining what to put in the second line of the chart

if [ "$line2" == "" ]
	then
		echo "|                                                                                 |"
	else
		echo "| $line2 |"
fi

# determining what to put in the third line of the chart

if [ "$line3" == "" ]
	then
		echo "|                                                                                 |"
	else
		echo "| $line3 |"
fi

# inserting parts of the chart

echo "|                                                                                 |"
echo "+---------------------------------------------------------------------------------+"

 

10 More Discussions You Might Find Interesting

1. Solaris

Whats the command to see

What fonts are installed on a Solaris 8? I have no GUI so a command line command would be great. Thank you (2 Replies)
Discussion started by: Acleoma
2 Replies

2. UNIX for Dummies Questions & Answers

Variable for -name causing issue in Find command

Hi there, I'm trying to find files that are greater then 30 days old, zip them and move to a different directory. I'm encountering an issue passing a variable (FilesToFind) to name within the find command. Here's the code I'm running: #! /usr/bin/sh FileDir=/home/ariba... (2 Replies)
Discussion started by: ParNone
2 Replies

3. Shell Programming and Scripting

Whats wrong with this 5 line script!

Hi #!/bin/sh user=$1 if " -eq 0 ] echo "No" else echo "Yes" fi I'm not quite sure whats wrong with this but I know its something silly. Any ideas? Thanks (9 Replies)
Discussion started by: c19h28O2
9 Replies

4. Shell Programming and Scripting

Get the line number of an unknown line

I need to get the line number for a line, but I don't know where the file the line will appear. The line is always constant, but appears in different places. ie abc bcd cde fff aaa bbb ccc ddd and I would need the line number for fff, any help on this would be greatly appreciated. (2 Replies)
Discussion started by: hidachab
2 Replies

5. Shell Programming and Scripting

Whats wrong with this line?

I have a file $I_FILE that I need to filter and store the 1st and the 9th columns in another file $O_FILE. With this in Perl, system ("awk -F, '{print \$1, \$9}' \$I_FILE | sed '\/^\$\/d' > O_FILE"); I get: 4096045055 The first line in I_FILE is:... (5 Replies)
Discussion started by: looza
5 Replies

6. Shell Programming and Scripting

whats wrong with this line using perl

E:\>perl -00ne 'push @a,"$_\0$ARGV\n";END{print reverse split/\0/ for sort @a}' file1-obj_prof.out.txt file2-obj_prof.out.txt' Can't find string terminator "'" anywhere before EOF at -e line 1. (6 Replies)
Discussion started by: richsark
6 Replies

7. Shell Programming and Scripting

Whats does this export command do?

Hi, I know that export command is used to set environment variable. Can you please explain what ":--100" in the below command is doing? export ROWSTOLOAD=${ROWSTOLOAD:--100} Thanks, Gangadhar (5 Replies)
Discussion started by: Gangadhar Reddy
5 Replies

8. Shell Programming and Scripting

Pipe causing last command error to not function

Hi I am quite new to scripting and cannot work out how to do the following - I want to pipe to a log file and then use the "last statement error" in an if statement after, and this doesn't work because it checks the pipe statement instead of the script. Example: executteTheScript $var |... (4 Replies)
Discussion started by: erjorgito
4 Replies

9. Shell Programming and Scripting

While loop is causing ssh command to exit from script after first iteration.

I am trying to check multiple server's "uptime" in a loop over "ssh". When I execute multiple ssh commands with hard coded servernames script is executing fine. But when I pass server names using while loop, script is exiting after checking first server's status, why? # serverList... (8 Replies)
Discussion started by: kchinnam
8 Replies

10. Programming

Arduino-cli - Uploading to Unknown Chinese Arduino Boards using the Arduino Command Line Interface

In my further exploration of Arduino, today I decided to install the arduino-cli on my mac today. https://github.com/arduino/arduino-cli I followed the instructions for macOS but when I got to this part: arduino-cli board list I got the dreaded "Unknown" Fully Qualified Board Name... (1 Reply)
Discussion started by: Neo
1 Replies
GLOBASH(1)							 GLOBAL Utilities							GLOBASH(1)

NAME
globash - invoke a GLOBAL shell environment. SYNOPSIS
globash DESCRIPTION
globash is a bash shell enviroment that provides easy access to GLOBAL data about a project. More information about its use is available in the global.info documentation, and from globash itself at any time with the ghelp command that is available from inside it. OPTIONS
There are no options. Or blue pills. Just a simple shortcut to a bigger shell game. FILES
/etc/globash.rc - where all the real machinery lives. BUGS
As a wrapper globash gets to inherit bugs from other software too. But its hardly big enough to have many on its own. SEE ALSO
gtags(1), global(1), htmake(1), htags(1), and the global info documentation. AUTHOR
Ron Lee <ron@debian.org>, wrote this manpage, added the globash wrapper, and made a few minor tweaks to the globash.rc file which does all the real work and was written by Shigio Yamaguchi. Debian GNU/Linux 6 August 2005 GLOBASH(1)
All times are GMT -4. The time now is 10:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy