Tag Archives: TERM

Help with error "por: 0403-012 A test command parameter is not valid."

By blacksteel1988

Hi, im asking for help with the next script:

Code:

echo ^[[32m Mails Pending ^[[37m
VAR1=`query1.sh`

if [ $VAR1 -ge 200 ];
then
if [ $VAR1 -ge 300 ]
then
printf "33[01;31m%s33[00mn" "$VAR1"
else
printf "33[01;33m%s33[00mn" "$VAR1"
fi
else
printf "33[01;32m%s33[00mn" "$VAR1"
fi

echo " "

sleep 30
clear
done;


query1.sh:

Code:

export TERM=vt100
export ORACLE_TERM=at386
export ORACLE_HOME=/home_oracle8i/app/oracle/product/8.1.7
export ORACLE_BASE=/home_oracle8i/app/oracle
export DBVISIT_HOME=/usr/local/dbvisit

PATH=/home_oracle8i/app/oracle/product/8.1.7/bin:/usr/ccs/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME
/bin:/usr/bin/X11:/sbin:$DBVISIT_HOME:.
export PATH
export ORACLE_SID=ORAB817
export DISPLAY=192.9.200.121:0.0
export NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1
export ORA_ENCRYPT_LOGIN=TRUE
set umask=022
sqlplus -s " / as sysdba " @query1.sql


query1.sql:

Code:

set serveroutput on
set feedback off
set head off

SELECT 'MAILS PENDING : ' || COUNT ( * ) "Correo Por Enviar" FRO
M SCHEMA.CSIC_MAILS_fOR_SEND@VIRT.DB.TGU.COM WHERE estado = 0;

exit;


When i execute the script it returns what i want, but before that it always gives me the error “j.sh[224]: por: 0403-012 A test command parameter is not valid.”

From: http://www.unix.com/shell-programming-scripting/221405-help-error-por-0403-012-test-command-parameter-not-valid.html

How to restrict ssh by forced commands but sftp login should be enabled?

By Anil George

Hi,

I am trying to restrict an ssh-user to execute unwanted commands using ssh from a remote host a. So for that I am using the forced command in the authorized_keys file that will allow the ssh-user to only execute a particular command.

If I did not set this, I am able to login via ssh and sftp.

How can I differentiate whether the remote connection is issued via ssh or sftp in a shell script?

The command that I am expecting is as follows and these both should work:-
ssh ssh-user@hostname test_scripts.sh
sftp ssh-user@hostname

I used the variable $TERM to differentiate between ssh and sftp. If it is sftp then the $TERM will return ‘dumb’. But when we are passing a command through ssh then the $TERM is returning dumb.
Any idea how to differentiate?

Source: FULL ARTICLE at The UNIX and Linux Forums