I'm trying to use multiple parameters with the useradd command in linux, and I'm not really sure exactly what I should do??
I have tried the following:
useradd -b /home/ -g admin -m -p PASSWD -s USERNAME
Needless to say, it doesn't work. Can anyone tell me the correct syntax to get this working? Thanks, your help is always appreciated...
Does python have any way to easily and quickly make CLI utilities without lots of argument parsing boilerplate?
In perl6, the signature for the MAIN sub automagically parses command line arguments.
Is there any way to do something similar in python without lots of boilerplate? If there is not, what would be the best way to do it? I'm t...
I am looking to do some error checking for my command line arguments
public static void main(String[] args)
{
if(args[0] == null)
{
System.out.println("Proper Usage is: java program filename");
System.exit(0);
}
}
However, this returns an array out of bounds exception, which makes sense. I am just looking ...
I am using Heat.exe to harvest a directory containing my DLLs that need to go into the GAC. The fragment is correctly created and I can build my MSI. The problem I am having is that after the wxs source file is created I have to manually edit the file adding the File/@Assembly =".net" attribute.
Is there a way to have heat include Assem...
I am writing a session saver for GNU Screen. It needs to get every process argument list. Linux has /proc/PID/cmdline which separates arguments with \0. Solaris has pargs. But I am looking for a more crossplatform solution and ps tool seems to be the best bet. "ps -o command" displays argument list but separates arguments only with space...
I'm trying to tell unix to print out the command line arguments passed to a Bourne Shell script, but it's not working. I get the value of x at the echo statement, and not the command line argument at the desired location.
This is what I want:
./run a b c d
a
b
c
d
this is what I get:
1
2
3
4
What's going on? I know that UNIX is con...
cat monday.csv
223.22;1256.4
227.08;1244.8
228.08;1244.7
229.13;1255.0
227.89;1243.2
224.77;1277.8
cat tuesday.csv
227.02;1266.3
227.09;1234.9
225.18;1244.7
224.13;1255.3
228.59;1263.2
224.70;1247.6
This Perl one-liner gives me the row with the highest value in the second column from the rows where in...
I have booted my system from a live Ubuntu CD, and I need to fix some package problems. I have mounted my hard drive, and now I want to run apt-get as if I booted normally. ie change the working directory for apt-get so it will work on my hard drive. I have done this before, but I can't remember the syntax. I think it was only some flag,...
I'd like to pass some user supplied arguments to an application (using C# on Windows).
The arguments are in a NameValueCollection and I wish to pass them as a string so that the application can be invoked using the supplied arguments and invoked using ProcessStartInfo:
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.UseS...
I want to parse a list of arguments in a perl script, for example i have this situation :
script.pl -h 127.0.0.1 -u user -p pass arg1 arg2 arg3
How can i do for parse the list of argument that aren't option in an array, and the option parameter in scalar value ?
Thanks.
...
Hey all -
I'm working on a C++ program that accepts a filename as a command line input, reads a bunch of data from that file, computes two things about the data, then exits. One of those computations must be done, but the other is much more optional, so I thought it would be neat to add a -c flag to turn it off. Naively, I would just a...
My C Win32 application should allow passing a full command line for another program to start, e.g.
myapp.exe /foo /bar "C:\Program Files\Some\App.exe" arg1 "arg 2"
myapp.exe may look something like
int main(int argc, char**argv)
{
int i;
for (i=1; i<argc; ++i) {
if (!strcmp(argv[i], "/foo") {
// handle /foo
} e...
I would like to clear the command line of my process from within. For example, when viewing my process in Task Manager/Process Explorer, the command line entry would be empty.
I would like to do this within the currently running process rather than restarting the process if possible.
...
my python version is 2.4.3.
Now I am developing a CLI with cmd module from python for a CD player. I have some classes like CDContainer (with method like addCD, removeCD, etc), CD (with method like play, stop, pause). Now, I want to add some options for the commands and also if the options inputs are not correct, the CLI could return pr...
Hi,
I am relatively new to Ruby and need to write a script that will handle mulitple input files. It should be called like so:
script.rb -i file*
where the directory contains multiple files, like file1.xml, file2.xml and so on.
Just a quick question: How will this wildcard be expanded? Do I need to program that in my script? I am usi...
If I want to pass a program data files how can I distinguish the fact they are data files, not just strings of the file names. Basically I want to file redirect, but use command line arguments so I can a sure input is correct.
I have been using:
./theapp < datafile1 < datafile2 arg1 arg2 arg3 > outputfile
but I am wondering is it po...
Hey, so lets say I get a file as the first command line argument.
int main(int argc, char** argv) {
unsigned char* fileArray;
FILE* file1 = fopen(argv[1], "r");
}
Now how can I go about reading that file, char by char, into the char* fileArray?
Basically how can I convert a FILE* to a char* before I know how big I need to ma...
I am developing cli with python version 2.4.3. i want to have the input exception check. The following is part of the code. With this code, I can type
addcd -t 11
and if I type
addcd -t str_not_int
or
addcd -s 3
I will catch the error of wrong type argument and wrong option. However, it is not sufficient. e.g.
addcd s 11
or...
Hello,
I know the program name is passed as the first argument, and next simple example will print it to the standard output :
#include <iostream>
int main ( int argc, char *argv[] )
{
std::cout<<argv[0]<<std::endl;
}
Is there a function to get the program name?
EDIT
I am starting the program from the shell, and the above code wi...
I am trying to utilize the OptionSet class in the following way:
string resultsFileName = null;
bool isHelp = false;
var p = new OptionSet() {
{ "r=|resultsFile=", "The file with the results", v => { resultsFileName = v; } }
{ "h|help", "Show this help", v => { isHelp = (v != null); } },
};
try
{
p.Parse(args)...