The tag has no wiki summary.

learn more… | top users | synonyms

3
votes
4answers
131 views

Provide strings stored in a file as a list of arguments to a command?

I install a list of URLs in a text file named myurls: http://www.examples.com/1 http://www.examples.com/2 http://www.examples.com/3 How shall I pass these URLs to wkhtmltopdf as inputs? The direct ...
0
votes
1answer
52 views

How many files can rm delete at once? [duplicate]

One of my friends wanted to have more logs in the /var/log/ directory, and after some time of using the system, he tried to access the folder and list it, but instead he got the following error: ...
3
votes
4answers
102 views

How do I get the value of a named option of an already running process in Linux?

I run the following command. ps -e -o args | grep destiny | grep UNIX I receive the following output. /path/to/destiny -r -m UNIX -t TCP -p 1501 What command can I use the get the value of the ...
0
votes
1answer
26 views

How does “command < filename.txt” look when passing filename into a command

I've got a scenario where I have command < filename.txt so I can pass the contents of filename.txt and use it in command. But say I want to take the contents out of the file and just use them in ...
0
votes
2answers
47 views

Help with passing parameters to a file and fetching the credentials

I have developed a shell script which takes schema id and password as parameter to login into database using sqlplus,runs a query and mails the result. Below is the code snippet: #!/bin/sh #Two ...
1
vote
2answers
82 views

How to extract unknown arguments within a shell script?

I have a shell script that accepts a variety of options, some with arguments, some without, some short, some long. It should handle some of these options itself and pass on the rest it does not know ...
0
votes
0answers
31 views

Passing argument in tcl proc

I have a tcl proc as follow: proc foo {a {b 300} {check FALSE} {c 100}} { //doing something here } Can I pass the value to c argument while still using default values for b and check arguments ...
0
votes
2answers
83 views

bash execute command for X arguments at a time

I have a list of files stored in txt file. ./test7 ./test4 ./test1 ./test5 ./test6 ./test10 ./test8 ./test2 ./test9 ./test3 I want to run a command on all those files but I want to sleep 1 second ...
2
votes
1answer
45 views

Bash completion - How to get filename completion for suboptions

I have a function which can take main arguments and then sub-arguments. Some of these sub-arguments are filenames. The current completion code I have is as follows. _scm() { local cur prev opts ...
1
vote
0answers
24 views

What Does the Output of “--help” Mean? [duplicate]

When using the --help option of a terminal program, a lot of output is produced. It usually starts with Usage: and then a bunch of things and brackets and parentheses. My question is, what doe the ...
1
vote
3answers
157 views

Shell expansion for arguments?

For example: mkdir ~/{1,2,3} Creates directories ~/1, ~/2, and ~/3. It equates to: mkdir ~/1 mkdir ~/2 mrdir ~/3 But, using the same syntax in the case of CMD < argument > : brew {install, ...
2
votes
1answer
50 views

Order between options and operands?

When using a utility program, we may specify options (and their option arguments) and/or operands. In most cases (in the sense of conforming to some standard (POSIX?)) does the order between ...
2
votes
4answers
80 views

input file stream to command

How is it possible to send a file stream to this command instead of a file? /usr/local/bin/wkhtmltopdf --title "$SUBJECT" -q $SOURCEFILE $OUTPUTFILE The file stream is from a string in PHP.
1
vote
2answers
37 views

Do I need “| xargs -n 1” to get around xargs' -I side-effect?

I was suprised to discover this: $ echo 1 2 3 4 5 | xargs -n 1 echo 1 2 3 4 5 $ echo 1 2 3 4 5 | xargs -n 1 -I FOO echo FOO 1 2 3 4 5 That is, using the -I flag has this side effect: Also, ...
1
vote
1answer
43 views

Using parameters in a script

I usually use the find command to automatically copy certain multimedia files from directory A to directory B. I use the following command: for f in `find ./ -name "*.mkv" -mtime -24h`; do cp $f ...
0
votes
2answers
54 views

How to pass arguments to perl when trying to change a line?

I am using the approach suggested in http://askubuntu.com/questions/434051/how-to-replace-a-string-on-the-5th-line-of-multiple-text-files to modify the first line of an archive. Let's suppose the ...
0
votes
1answer
190 views

/usr/bin/awk: Argument list too long

I am trying to run the following bash script: #!/bin/bash file=$1 filename=${file%%.*} line1=$(sed -n 1~2p ${file}) seqs=$(grep -v '^>' ${file}) pos=$(echo "${line1}" | awk -F"[__]" ...
1
vote
1answer
184 views

pass all files in directory as one argument to perl script

linux beginner here I have a directory with 50 files in it and I want to simultaneously pass them all to a perl script with just a space between names , as in... ./perl_script.pl file1 file2 file3 ...
4
votes
3answers
169 views

Bash, insert last used argument of current command

I'm aware that you can recall the last argument of the previous command with !$ and also cycle through previous arguments with ALT + . but can you recall the last argument used for the current command ...
0
votes
0answers
34 views

Pass a function arguments?

How would you make a function that gets arguments? function arg_example { arg "c" # This is imaginary but it would return 'true' if it found the argument -c. did_find_arg=$? # Get the ...
1
vote
3answers
65 views

UNC Argument in bash scipt

I want to create a bash script with a "pure" UNC (i.e. I do not want to escape the backslashes literally) as an argument, i.e. something like: ./foo \\my\share\is\here However, as is natural, the ...
0
votes
0answers
20 views

What's the difference between `set` and `modify` in *nix command syntax

I'm creating a new custom script that will be able to add, modify|set and delete certain rules of DNS records. I was looking for a proper naming convention of *nix tools that might help me name the ...
0
votes
1answer
474 views

Passing variable in init.d script

I have the init.d script show below. I want to start the daemon with the argument --http_root /tv When I start the application without the daemon the argument is accepted However I cannot seem ...
3
votes
1answer
53 views

Shell expansion and positional parameters

I want to make an script equivalent to zgrep or bzgrep, but using tar. I made two very similar attempts and I would like to know if there is a better one and if they could be improved or they are ...
1
vote
1answer
25 views

How do I make an alias to substitute single word in a piped command? [duplicate]

I use aliases a lot but right now only for use cases like alias i='sudo apt-get install -y'. I often would like to add an alias in the following form: alias cmd='echo [something] >> ...
4
votes
2answers
95 views

Unzip source arguments

To copy a bunch of zip files from one location to another: $ cp *.zip destination/ To unzip a bunch of zip files to a directory: $ unzip \*.zip -d destination/ man unzip says: The backslash ...
0
votes
2answers
88 views

Why doesn't this pipe command work at this special bash script?

That script test.sh doesn't work after used pipe command. The result shows nothing. Why? #!/bin/bash fun=$( echo $1 ) echo "$fun" commands are as follows, $ echo 1 | ./test.sh
0
votes
2answers
111 views

Can't use argument in bash date calculation script

The following bash script won't work. I need to calculate the date depending on the number of days since 14th Oct 1582, where the argument will be the number of days. d="$1" date -d '14 Oct 1582 + ...
6
votes
1answer
208 views

Function that calls another function with list of arguments doesn't work

In my .bash_aliases I have defined a function that I use from the command line like this: search -n .cs -n .cshtml -n .html SomeTextIWantToSearchFor /c/code/website/ /c/stuff/something/whatever/ ...
2
votes
2answers
345 views

Optional arguments after or before the mandatory arguments?

I'm creating a shell script and I need it to take two mandatory arguments and one optional. How do I check that? In most scripts I've seen, the optional arguments are passed before the mandatory ones, ...
2
votes
1answer
1k views

Why am I getting “too many arguments”

Here's a part of my script that is telling me that I have too many arguments on line 3: #!/bin/bash export LC_ALL='C' if [ `echo "*file 2" | grep -o ^.` = '.' ] then echo success fi Anybody ...
0
votes
0answers
18 views

Find out which arguments an application supports

I have iOS Simulator.app on Mac. Is there a way to find out what arguments can be passed to the app through the command line?
1
vote
2answers
1k views

Check that a bash script has exactly two arguments which are directories

I'm writing a bash script that compares two directories, but I'm not sure how to check conditions For example, if the user enters 1 arg instead of 2 (we need 2 since we're comparing two directories), ...
1
vote
1answer
113 views

Understanding grep and pipes in linux

I came across this post which explains my problem. Suppose there is a file called file.txt which contains "foo World". The answer posted by Tyler explains a lot however I am confused as to how cat ...
5
votes
1answer
110 views

How can I create an alias that passes additional arguments?

I have an executable that I use often: /dir1/dir2/dir3/dir4/executable argv[1] argv[2] argv[3] I know that I can set an alias for the executable: alias myexecutable = ...
3
votes
2answers
54 views

How is it possible to execute a command with an unknown number of arguments in a POSIX shell?

I want to search for multiple words inside the current directory. To accomplish this I use something like this. grep -e "word1" -e "word2" -R . This works fine. Taking this one step further, I ...
1
vote
3answers
892 views

Pass arguments to a command run by another user

I have a bash script that is supposed to take some arguments and then run in a different user: test.sh #!/bin/bash sudo su user2 <<'EOF' echo $1 EOF However it prints blank: $ ./test.sh ...
2
votes
2answers
1k views

bash how to remove options from parameters after processing

I remember having seen somewhere a bash script using case and shift to walk through the list of positional parameters, parse flags and options with arguments when it encounters them, and removes them ...
2
votes
4answers
294 views

Modify bash arguments if only one argument is set

I created a script with the standard getopt magic, so you can call the script with batman-connect -c ffki How can I add an option to call this script with only one option without dash? ...
7
votes
2answers
1k views

Bash string concatenation used to build parameter list

Given this piece of bash: PARMS='-rvu' PARMS+=" --delete --exclude='.git'" echo $PARMS rsync ${PARMS} . ${TARGET} The echo shows the PARMS string as expected, no error is displayed, but rsync ...
2
votes
1answer
68 views

How to get clicked-on filename as argument of shell script triggered by this mouse-click

If, in Ubuntu's Nautilus, I click a midi-file, a window opens to specify an application for processing the file. Another option is a "user generated command" (UGC). (Let me choose Ubuntu, Nautilus, ...
4
votes
3answers
152 views

Passing arguments from one command into the next

I'm trying to write a script to unify two separate commands I run by hand into a single bash script I can then cron. The first command is a simple find on files with a certain name and size find ...
9
votes
0answers
1k views

When do I need to specify add_efi_memmap as kernel argument in UEFI/EFI boot?

I am reading some tutorials how to EFI stub (efistub) load the Linux kernel. These instructions often use kernel boot parameter add_efi_memmap. The intended hardware is Intel x64 having 8GB of RAM. My ...
0
votes
2answers
228 views

Shell script to work on files in some directory

I am a noob in Linux hence this might come as a silly question. I have a Windows system, so I downloaded cygwin to help me execute Linux/unix commands. I need to execute a shell script on a bunch of ...
5
votes
2answers
336 views

How do you get fgrep to find the literal “--help”?

fgrep --help | fgrep "--help" returns just the whole fgrep --help, how do I return just the lines that have the literal "--help" in them? The quotes don't do anything, nor does \-\-help.
3
votes
1answer
97 views

scp to an alias

To transfer a folder from my local host to a remote host, I normally do: $ scp -r myFolder user@host:destFolder/ Trying to make this easier, I aliased the remote host destination: $ alias ...
0
votes
1answer
240 views

Mandatory argument for script to run java program

My script is called: report_startDate It has the following line: $JRE_ROOT/bin/java -cp /home/me/report/config/:/home/me/report/jar/reporting-1.0-SNAPSHOT.jar com.me.project.report.Main $1 $1 ...
23
votes
1answer
987 views

When and how was the double-dash (--) introduced as an end of options delimiter in Unix/Linux?

I don't think the shell/utilities in historical Unix nor in something as "recent" as 4.4BSD supported using a double-dash(or two consecutive hyphens) as an end of options delimiter. With FreeBSD, you ...
37
votes
7answers
3k views

Is `-` used only with cd?

cd - can switch between current dir and previous dir. It seems that I have seen - used as arguments to other commands before, though I don't remember if - means the same as with cd. I found that - ...
0
votes
1answer
186 views

Must pass urls in quotes

I'm trying pass a URL to mpv for it to play it as a network stream. This can be done in bash with the following syntax: $ mpv http://myvideosite.com However, zsh wants to evaluate the URL as ...