Questions tagged [command-line-arguments]

Programming command line utilities that take parameters.

0
votes
1answer
14 views

How to find the occurrences and location of characters in command line arguments

I'm new to command line arguments, but I have to find the occurrences and locations of a multiple word string. Say I enter in: good dog I would enter in o on the command line to get three counts of ...
0
votes
0answers
9 views

In pytest what does the option string '-xvvv' mean

Am seeing lots of examples of pytest (py.test) invocations that include the argument string '-xvvv'. I understand that -x means stop at first fail and a single v means verbose output. What do the ...
2
votes
2answers
28 views

How to execute separate scripts based on list box selections in command line?

I have searched the web for this, and cannot seem to find what im looking for. I am sure it is because I don't know the terminology (excuse me, I am not the best at coding). I want to list items in ...
0
votes
0answers
24 views

bash script accepts a command line argument (file) and options (extensions) to cp file >> .bak or .190318 options

Here is what I have: #!/bin/bash #Create script that passes a command line argument of file # with options to create backup of the file # with either the .bak or .190318 extension ...
2
votes
1answer
39 views

CommandLineParser - Value not changing

I created a small project, which uses the CommandLineParser library. I took a small code snippet from the guide C# Quick Start: using System; using CommandLine; namespace QuickStart { class ...
0
votes
0answers
11 views

How can I assign options to a python script like :if user writes “script -a” it does sth, and if he writes “script -b” it does sth else? [duplicate]

How can I assign intro(made by X) and options to a python script like :if user writes "script -a" it does sth, and if he writes "script -b" it does sth else?
0
votes
1answer
26 views

Set the output of command to variable in Batch file [duplicate]

I am trying to find the path of Java in the system using this command. where /r "c:\Program Files (x86)\Java" java.exe Now I want to set the out put of the where command to a variable so that i can ...
1
vote
2answers
59 views

Updating caller's argument array from within a function

In Bash I can set $@ this way: set -- a b c Then, I can inspect the content of $@: printf '%s\n' "$@" which would show: a b c However, if I do this in a function: f() { set d e f } set a b ...
0
votes
0answers
13 views

Is it possible to combine multiple arrays using linux command line?

I'm wondering if I can create a table or file in which I can fill it with elements from other files as the following illustration: cat_table_1/file1 1 cat 2 scooter 5 ball 6 coffee cat_table_2/...
0
votes
0answers
38 views

How to randomize and remove whitespace from input redirection in C

I want to pass a text file using input redirection to my program as a command line argument. I would then like the words in this to be randomly printed and whitespace removed. I would like to run the ...
1
vote
2answers
78 views

Converting an argument to main to an int [duplicate]

I am attempting tom write a simple program in which I accept a command line argument, convert it to an integer and print it to the screen: #include <stdio.h> #include <stdlib.h> int main(...
1
vote
1answer
50 views

Pass a list to a Python script as a command line argument

I am currently facing a problem while I want to put list as argument. list is this format : [1,0,0,0] and I'm going to do something like this in another python code: os.system('python main.py %s' ...
0
votes
0answers
29 views

How to check if a command line argument is a double or string in java? [duplicate]

Hi guys I am a beginner in Java and I have looked for an answer to this question but couldn't find it. Basically I want to multiply 3 command line arguments provided by the user, however, if user ...
0
votes
0answers
9 views

Cannot pass / to a script from windows gitbash

Example program (test.py): import sys print(sys.argv) Example command, run from bitbash: $ python test.py / ['test.py', 'C:/Program Files/Git/'] For some reason, I'm not able to pass "/" to the ...
0
votes
2answers
79 views

Do I have to implement garbage collection manually in Java?

I already read some about garbage collection in Java, but I can't find the "best practice" to handle the garbage collection in code. Should I set every variable to null after use, or is it more ...
2
votes
2answers
47 views

getopt usage with/without option

I'm writing a simple code making use of *argv[] parameter. I'd like to know whether I can use getopt() function for the following intent. ./myprogram -a PATH ./myprogram PATH The program can either ...
0
votes
1answer
19 views

Command line argument javafx

I am trying to write a simple program to plot a line graph using javafx. I have the following code: public class Plot extends Application { public void start(Stage stage){ } public static ...
1
vote
1answer
26 views

passing exclamation, brackets as part of executable arguments in powershell

In git, if we want to exclude a file from diff output (on bash) we do something like follows: git diff -- !(file.txt) But this is disallowed in powershell. Hence is there a way to achieve this in ...
0
votes
1answer
18 views

arm-non-eabi-ld: Argument list too long

I'm trying to resolve an issue with my project. In short, I have a variable in my makefile containing the names of .o files to be linked. The variable has gotten too big, and is now causing an ...
1
vote
1answer
22 views

Singularity containers: adding custom packages to $PATH and pass it to singularity exec

I'm in the process of making a singularity container with PLINK v 1.9 (a genetics software, not the PuTTY interface, https://www.cog-genomics.org/plink/1.9/dev) inside it. I'm able to successfully ...
2
votes
1answer
45 views

Pass command-line arguments to WiX custom action

We have a desktop application installed through a windows installer (msi), and we want to add a custom action that relaunches the .exe when we have pass LAUNCH_APP=1 to the cmd. So I have a vbs ...
0
votes
2answers
30 views

How to extract two Paths from args in command-line Java?

I'm making a Huffman Tree implementation that takes some data and prints the leaves of the tree, or serializes the tree into a file. The implementation uses a custom command line program that receives ...
-1
votes
1answer
74 views

Greater than (>) symbol not recognised in debug command line arguments Visual Studio 2017

I am currently trying to debug an application and I am passing debug command line arguments via Visual Studio when starting the application as this is the only way available to me to debug this. When ...
1
vote
1answer
43 views

How to get the program name in an escript program?

I have an Erlang program meant to be run using escript: % filename: myscript.erl -export([main/1]). main(Args) -> io:format("Args: ~p~n", [Args]). When I run escript myscript.erl 123 456, ...
0
votes
0answers
77 views

Python doesn't take input from command line

Here's the code I've been trying to run using command line or as batch file. It's not taking the argument and instead just opens the link with nothing else as input. It used to work before but I reset ...
0
votes
1answer
22 views

Strict command line parser

in connection with this Apache command line parser (Since it is completely out topic). Is there a way to strictly follow the short hand. Like -m and not -multi or for long name it should be --multiply ...
0
votes
3answers
35 views

How to pass command with its arguments as a single argument to script?

I have a script I use for building my kernel, and in it I have a function I want to use to catch errors in my build commands, but I can't figure out how to pass multiple arguments as one to get it ...
0
votes
1answer
27 views

Python Argparse: Arguments Within Optional Arguments

I am writing a script that can do multiple things, depending on the arguments passed into the command line. For example: #changed and simplified from actual code parser.add_argument('-a','--apple') ...
0
votes
1answer
33 views

How to run certain function based on command line input given in python

I have my main script where i have two functions defined. The or_search will find occurrences of a string specified and add to the list what index position it has been found within. The second ...
0
votes
1answer
71 views

How can I distinguish a multi-occurence option from a subsequent optional argument with structopt?

I am using structopt to define arguments that can be used mfe -s opt1 -s opt2 -s opt2 this_is_an_argument or mfe -s opt1 opt2 opt3 this_is_an_argument The problem is that the this_is_an_argument ...
2
votes
2answers
77 views

How can I use enums in structopt in Rust?

I'd like to make StructOpt work with enums such that every time a user passes -d sunday it'd parsed as a Day::Sunday: #[macro_use] extern crate structopt; use std::path::PathBuf; use structopt::...
0
votes
3answers
50 views

Make Python Project Into Command Line Tool

I have a python project with multiple files and a cmd.py which uses argparse to parse the arguments, in the other files there are critical functions. What I want to do is: I want to make it so that if ...
0
votes
0answers
19 views

Parser.Default.ParseArguments always returns false

I have added CommandLineParser library into my project and I have configure all the arguments which should be provided to my project for to support silent installation of the same. An InstallOptions ...
0
votes
2answers
25 views

How to check whether GNU Make supports Guile

How to check from the command line whether GNU Make is built with support of Guile? Inside Makefile it can be determined via analyzing .FEATURES variable (see documentation).
0
votes
1answer
60 views

Accept file and pass arguments to function from command line gives no output

I am writing a script to accept (optional) two arguments in command line: --top to return top words by count e.g. --top 5, returns top 5; --lower to lower a list of words before counting the unique ...
1
vote
2answers
64 views

getopt() function exhibiting weird behaviour

Adding getopt() for option arguments to an already existing program results in weird behaviour. The program takes a string input then reads words from a file(each on a new line) and checks if the ...
0
votes
1answer
68 views

How can I rewrite the programs, so that I don't have to call`flex` but only call `bison` and `cc`?

I already have a calculator program based on bison and flex which takes input from command line arguments. Now how can I rewrite the programs, so that I don't have to callflex but only call bison ...
0
votes
3answers
65 views

How to fix ''couldn't match expected type IO a0 with int'' in Haskell?

The line checkArgCount args gives me the trouble. args is a type [String] isn't it? I'm confused over why it gives me error. import System.IO import Data.List import System.Environment --for command ...
1
vote
1answer
47 views

How to pass an unix command with white spaces to a shell script

C# program is calling a shell script with one argument. The argument is an unix command: port="/dev/ttyUSB0"; procStartInfo = new ProcessStartInfo("sudo", "sh test.sh " + "$(udevadm info - a - n " + ...
2
votes
1answer
52 views

Using Stack from Powershell, how do I pass test arguments that include a space?

I need to pass the string "fail log" as a tasty pattern argument when running tasty tests out of stack. This is quite straight forward in bash: PS C:\Pyrethrum> stack test --fast --ta "-p \"fail ...
0
votes
0answers
34 views

How to parse non-option command line arguments and stdin inputs?

We often use getopt library to parse option-like command line arguments. For non-option command line arguments, what are ways (and libraries) to parse them? For stdin inputs, what are ways (and ...
1
vote
1answer
52 views

Are there any problems in using a Static Member Function to initialize a Constant Member Variable in an Initializer List?

I wish to have a class in my program that directly takes the Command Line arguments from the main method. I want some of this information to be Constant to the Class, but also dependant upon the ...
0
votes
1answer
22 views

Is it possible to vertically rotate a showwaves (or showfreqs) overlay using ffmpeg?

I wish to take a showwaves (or showfreqs) overlay and center it vertically using ffmpeg, e.g. ffmpeg -i input.mp3 -filter_complex "[0:a]showspectrum=color=fiery:saturation=2:slide=scroll:scale=log:...
0
votes
0answers
52 views

Distribute command-line arguments using npm as a build tool

I have an npm package that manages my github repository and has scripts that build my publishable npm package. Due to the nature of the package, the published npm package (the distribution) cannot ...
0
votes
1answer
40 views

How can you print all the possible commands of a unix command line tool?

I want to see a list of all possible options for a specific command line tool. The --help option can be useful, but might not include all the options and sometimes you just need a list instead of a ...
0
votes
1answer
71 views

How to let a user enter command line arguments in any order?

I have to write an encrypt/decrypt C program and to start off it needs to take 6 CL arguments. This is normally fine for me, but this time the argument order needs to not matter. The flags also always ...
2
votes
2answers
128 views

Pass command line args to Java app (Spring Boot) running in Docker

I'm trying to pass command line args to the main method of a Spring Boot app running in a Docker container. Running from the command line, I would do something like this: $ mvn spring-boot:run -...
0
votes
0answers
49 views

Passing arguments containing non-ASCII characters from bash to a Java program

Is it possible to reliably pass non-ASCII characters as command-line arguments from bash on CentOS? I keep getting wrongly encoded chars form the args. In my case it's a pesky ASCII 85h character ...
0
votes
0answers
12 views

How to allow for scripts to interact with command-line-application but also require authentication?

I need to create a command-line-application on windows that also uses authentication. Either the command-line-application would handle the authentication itself before continuing on, or it passes ...
0
votes
0answers
24 views

Commands are not working properly in my function?

I'm trying to run wasm-gc command in my code. but it is not giving me expected result. async function wasmGC(wasmFile) { if (!await exists(wasmFile)) { throw new Error("wasm is not found") } ...

http://mssss.yulina-kosm.ru