Programming :: Making A 1 Command Line Argument?

Jun 8, 2010

I need to write a script that will take 1 command line argument. The argument will be a username. The script will determine if the user exists on the system and will print an error if it does not. If the user does exist it will determine if the user is currently logged in, if the user is not logged in it will determine the last time the user logged in and display the file in the users home directory that was most recently modified.

View 2 Replies


ADVERTISEMENT

Programming :: Bash Shell Read User Argument From Command Line And Test It

Aug 29, 2010

Trying to create a small script that will read user's input, test if user entered some input and if not display some message or display a text using user's input.

The script is the following but i get an error saying "[: 6: =: argument expected"

View 12 Replies View Related

CentOS 5 :: Pass Shell As Command Line Argument When I Ssh To An Account

Jan 25, 2011

I want to have a choice or more preferable pass shell as command line argument when I ssh to an linux account.i.e. If John logs in to account "zzz" on server "abc", by default definition of account "zzz" n server "abc" he get csh.But Sally desires that when she logs in to account "zzz" on server "abc", she needs the login shell to be ksh,and Rick wants bash when he logs in to account "zzz" on server "abc".What is the most non-intrusive / easiest way to achieve this? Each user can set their preference on ssh command line or create a simple alias by each shell, but not sure how to do this.

View 6 Replies View Related

Programming :: Ssh Remote Command Preserve Quoted Argument?

Sep 17, 2009

I have a python script on one server (serv_one) and I am trying to execute it remotely from another (serv_two). The python script takes an argument with spaces. If I execute it locally:

Code:

foo@serv_one> script.py --o "arg one"
"arg one" is preserved, of course. ( argv = [ '--o', 'arg one' ] )

However, when I execute it remotely:

Code:

foo@serv_two> ssh ... foo@serv_one script.py --o "arg one"

the double quotes around "arg one" are dismissed ( argv = [ '--o', 'arg', 'one' ]. I've tried many combinations of single quotes/double quotes/backslashes, etc, to no avail. One hack solution I came up with, since I have the flexibility, was to replace all spaces in the quoted argument with a character that would be invalid in the argument (before the ssh call), and replace those with spaces in script.py. I would probably like to avoid this solution if at all possible.

View 7 Replies View Related

General :: Making Multiple Duplicate File Copies Using Cp On Command Line?

Jul 21, 2011

I want to take a graphics file and make 10 copies of it to the same directory, each with 001, 002, or some such designation at the end of each file name so they have discrete files names. Is this possible using cp?

View 12 Replies View Related

Ubuntu :: Making Interactive Command Line Apps More Friendly (bash Feature)?

May 21, 2011

I'm using a java application that runs as an interactive command line (in a terminal). My problem is that it's rather unfriendly as an interaction mode as it's minimalistic: it doesn't allow going to and fro with arrows, there's no history and so on. So I have to type all commands every time and have to retype it if I missed something at the beginning of the line, or I have to copy and paste from a txt editor. The strange thing is that I have seen the same application running on a Windows box and allowing for all the sugar. So I'm not sure if it's because of the shell script I run (as opposed to the .bat) or whether it has to do with system or profile settings in my shell.

For information, the shell script starts with:
Code:
#!bin/sh
I've replaced it with:
Code:
#!bin/bash

In hope I would have something closer to my normal terminal. The app runs but it doesn't change anything to the interactive mode. I'm rather clueless regarding sh/bash and so on. I've seen the manuals but I'm not entirely at home understanding and using their options. I know that there's a .bashrc and perhaps something like a profile somewhere, but I don't really know how to do things with these without risking messing up.

View 9 Replies View Related

General :: Making Packet Sniffer Using Raw Socket - Invalid Argument

Nov 16, 2010

I am actually making a packet sniffer using raw socket. Its just that when I use the command '
if((ioctl(rawsock, SIOCGIFINDEX, &ifr)) == -1)
to get the interface index...
Its gives me an error saying :invalid argument?

View 2 Replies View Related

Programming :: Effect Of Using Eval To Execute A Command As Opposed To Writing It On The Command-line?

Jun 18, 2010

Code: cmd='date | wc'

$cmd If this script is executed, an error is generated. The reason written was that "The execution fails because the pipe is not expanded and is passed to date as an argument".What is meant by expansion of pipe. When we execute date | wc on the command line, it goes fine.then | is not treated as an argument. Why?

View 4 Replies View Related

Programming :: Command Line Invocation Of Gnome-terminal To Run More Than One Command?

Feb 16, 2010

I am trying to learn how to pass more than a one-command startup for gnome-terminal.

I will give an example of what I'm trying to do here:

Code:
#! /bin/bash
#
#TODO write this for gnome and xterm
USAGE="
${0##*/} [-x] [-g]
code....

However, running with the -g option to invoke gnome-terminal, I get a "There was an error creating the child process for this terminal" error.

This same error occurs if the gnome-terminal line is changed to

Code:
gnome-terminal -e mcTerm

Is there any way to pass more than one command on to gnome-terminal? I have tried various single and double quoting senarios and in a final attempt, I abstracted to an exported function all to no avail. Perhaps even though gnome-term is better at many things than xterm, xterm trumps it in this instance.

View 4 Replies View Related

Programming :: Convert This Awk Command From Command Line Into An Awk Script ?

Oct 15, 2010

I'm trying to convert this awk command from command line into an awk script, but just cannot get it to work:

This is what i have after my BEGIN

Am i missing something here? this just prints out the count for everyline, not counting lines on 5th field that match 'A'

View 1 Replies View Related

General :: Making The Signal At Line In To Appear At Line Out?

Apr 12, 2011

Kernel 2.6.21.5, Slackware 12.0 Assuming I work in a text console (tty1,...,tty6) and that I have audio at Line In (the jack at the machine rear panel), how could I do to have it at Line Out?

View 6 Replies View Related

Programming :: Tutorial For Using GDB From Command Line?

Sep 15, 2010

Does anyone know from experience a good gdb tutorial, so I can learn to use it from the command line.

View 2 Replies View Related

General :: Read A Line In A File And Use It As Argument?

Mar 20, 2010

I want to do this

read a files's specific line but return as argument only part of it ie

...

value # this is mass

value2 # this is force

so, how can I get / use the $value and $value2 as arguments for some other file and skip the rest of the line(s) ? of course, the values are different everytime, but the comment always the same, as well as the position of the lines in the file

View 4 Replies View Related

Programming :: Check Command Line For A Word?

May 23, 2010

I'm building a script for my place of employment. The next step in it is checking what the user input was. Determining if they added a part in there or not. The script prompts for a hostname. Hostnames are localhost.localdomain. Now, I want the script to check to see if they put localdomain and if they did, not to add the domain to the /etc/sysconfig/network, but just what they entered. So say the user inputs:

[Code]....

View 4 Replies View Related

Programming :: Set For A Group Of Command Line Arguments?

Oct 11, 2010

i was wondering if someone could help me figure out a script for global variables i'm trying to set for a group of command line arguments:

basically i'm trying to set: if $# = 3 then i want to search for each all string $1 $2 $3

if $# = 4

then i want to search for each all string $1 $2 $3 $4

View 2 Replies View Related

Programming :: Echo Two Command Output In The Same Line?

Jan 25, 2011

I try to write script and echo two command at the same line .

echo "A"
echo "B"

How can I pipe above two command at the same line in text file . So, in the output text file , you can see below ? Code: A B not Code: A B

View 4 Replies View Related

Programming :: Using An Awk Command To Print A Line From A Cvs File?

Mar 4, 2011

I am using an awk command to print a line from a cvs file.the awk command includes an if statement that filter the output-lets say i want to print all the lines that the price field is greater than 30.i have it working when i put the parameters myself.. but when i try to send them with vars it wont work..i am sending the sign of the if statement - can only be: == , < , >it looks like this:

cat file.csv | awk -v sign=">" -v field="2000" '{if($3 sign field) printf "%-12s%-12s%-12s%-12s
",$1,$2,$3,$4}' FS=,

the bold part is the problem , because when i put the sign parameter myself t works great.. i guess its a chars issue but i cant spot it

View 3 Replies View Related

Programming :: Program That Activates A Command-line?

Feb 7, 2010

I am wanting to write a program that runs a program or command-line. Is there are way of making a program that activates a command-line (for example executing 'ps -a -f' or '/home/shared/fah').

In addition to that, I want the program to do a 'ps -a -f' and put the results in a buff, how could I do this.

View 5 Replies View Related

Programming :: Debugging QT Project Through GDB In Command Line?

Jan 31, 2011

First step will obviously be to compile the QT project with -g option, but how to do that through command line?

View 6 Replies View Related

Programming :: Diverting IDL Output To The Command Line?

Jul 14, 2010

I'm troubleshooting a batch of scripts I'm modifying, including an IDL script called by a .csh script. the IDL scripts were provided to me by a coworker and my .csh script is intended to automate a lengthy set of extremely tedious and time consuming processing tasks.

I am currently in the process of debugging, and can't get the IDL to print any messages other than critical failures to the screen. Is there any easy way to redirect the stdout to either a logfile or the screen?

View 2 Replies View Related

Programming :: Access Command Line Variables From Awk?

Feb 11, 2010

I am taking an argument from the command prompt for my shell script ie $1 and i need to use $1 in my awk part of the script.But it actually doesn't get any value when used in awk. accessing this command line argument in awk?

View 5 Replies View Related

Programming :: Compile A Big Project In Command Line?

Jun 10, 2010

I've got the "OpenCryptoKi" project source from "sourceforge.net" at here:But I don't know how should I compile and build it by "GCC" or "Make"?!I have ubuntu 9.04 and I've set the linux runlevel at 3, but I'm not so familiar with compiling such project at commandline environment of linux

View 6 Replies View Related

Programming :: How To Get Source Code Of Command Line?

Jan 23, 2009

I just want to see how the command line such as : "cat", "split", "ls"...ect source code ? Are they written in C or other language ? I don't know where to search those?

View 6 Replies View Related

Programming :: Parsing Command Line Arguments In PHP?

Feb 1, 2010

I want to know how to get eg. the contents of a form on a webpage which has been passed to a server side PHP script, inside for example an array which I can read. I've been reading a ebook on PHP which as far as I can see doesn't cover this inside it.

View 1 Replies View Related

Fedora :: Run Python3 Scripts From Command Line And Call Up Python 2.6.2 Idle With The Command Idle From Command Line?

May 29, 2010

i've gotten my fedora 12 to the point where i can run python3 scripts from command line and can call up python 2.6.2 idle with the command 'idle' from command line. what command will call up python3 (3.1.2 to be exact) idle?

View 5 Replies View Related

Debian Programming :: Automate Command Line At Start-up

Jan 26, 2015

I'm trying to automate two command lines, a synclient and a syndaemon. They both work well if I type them manually in a terminal, but if I do a littre script to do this, tap to click and scrolling don't work anymore.

This is the script I wrote:
Code: Select all#!/bin/bash
synclient VertEdgeScroll=1
syndaemon -d -t -K
exit 0

So I made a chmod +x on the file, placed it in ~/bin then change PATH to include the directory. Then I added this file in "Startup applications".

The scripts run ok, mais it has a different effect than if I run the commands manually.

View 10 Replies View Related

Programming :: Extract Via Command Line The Latitude And Longitude?

Aug 10, 2010

I trying to extract via command line the latitude and longitude with this command Code: curl -s [URL]

View 4 Replies View Related

Programming :: Declare An Associative Array On The Command Line?

Apr 19, 2011

I am trying to declare an associative array on the command line. I get the following error, could somebody explain this and reslove

$ declare -A score_array
-bash: declare: -A: invalid option

View 1 Replies View Related

Programming :: Echoing A Command Line Within A Bash Script?

Jul 8, 2011

Bash 3.1.7

Suppose this bash script:

Code:
#!/bin/bash
ls foo

I would like the output to be

Code:
ls foo
foo

That is, the command is first echoed then executed. Is it possible to do this? Or is the only way to debug the script?

View 2 Replies View Related

Programming :: Error: ./10aa: Line 5: [-n: Command Not Found 127

May 25, 2011

Quote:

Explain the error?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved