Tagged Questions
2
votes
0answers
28 views
KSH styling text based menu using STDERR
Is it possible to format the STDERR in order to have a better looking menu using the select command?
I have a simple select
select oChoice in $(<tempMenu.menu) ; do
case "$oChoice" in
...
1
vote
1answer
135 views
How do I execute a remote shell script over SSH and be prompted for passwords by commands that require it in that script?
I want to do something like this
ssh [email protected] ./remote_script.sh
Contents of remote_script.sh
#!/bin/bash
hg pull
This example is much simpler than what I am actually doing. I know ...
1
vote
1answer
56 views
How to format a curl command for a special task?
There is a search page in a form http://site.com/search.php and it sends a search query via POST request. I want to fetch this request via curl command line tool to inspect a POST request.
The HTML ...
12
votes
8answers
757 views
What is the utility of the : command in shell scripting, given that it explicitly does nothing?
In the answer to this question about comments in shell scripting, it is indicated that the : is a null command that explicitly does nothing (but is not to be used for comments).
What would be the ...
1
vote
1answer
31 views
Load command parameters from upper level file
I've come across an interesting problem that I have not yet been able to solve satisfyingly.
Consider a note taking command that takes two arguments:
note $project $note
That simply files the ...
1
vote
1answer
66 views
Running shell commands in .sh file results to error
I have two following linux shell commands:
echo 'CPU type and model'
cat /proc/cpuinfo | head -5 | tail -1
When i run these commands directly in Terminal, i get this result truly:
CPU type and ...
15
votes
3answers
449 views
Which are the standard commands available in every Linux system?
I would like to know which are the standard commands available in every Linux system.
For example if you get a debian/ubuntu/redhat/suse/arch/slackware etc, you will always find there commands like:
...
9
votes
3answers
238 views
Substituting strings in a very large file
I have a very long series of urls with no separating character, in the same format as below:
http://example.comhttp://example.nethttp://example.orghttp://etc...
I want each URL to be on a new line. ...
3
votes
1answer
83 views
How to create a confirmation question in Linux?
I have a certain command (git push server-name) that has major consequences. How to require confirmation for this command only? It should ignore white space.
The confirmation could be Enter 'yes i am ...
0
votes
1answer
36 views
How to use a password as an external variable in shell?
I have this MySQL backup script that I use to back up MySQL databases. Very useful, and it runs on fixed intervals using a cron. However, I need somehow provide this script with the MySQL password. ...
0
votes
1answer
150 views
How to pkill from a script?
How can I write a script that basically just runs pkill -HUP inetd? I want to restart inetd via a script so I can schedule it to run at a particular time. I tried to write it myself, but I'm getting a ...
2
votes
2answers
45 views
Shell script output incorrectly splitting while being passed as an argument to script
Let's say I have the following two shell scripts:
#!/bin/sh
#This script is named: args.sh
echo 1 "\"Two words\"" 3
, and:
#!/bin/sh
#This script is named: test.sh
echo "Argument 1: "$1
echo ...
3
votes
1answer
80 views
passing file as a parameter with sed and loop
Here File1 is the template.
File2 is a csv with 200 rows with the columns scriptname ,jobname, templatename, location
The templatename is column with in the file2.
Is it possible to do it as below. ...
1
vote
2answers
154 views
To pass a parameter with sed
For my script I have to read the data from a file.
For example I have 2 files: one is a text file, the second is a csv file with 10 columns.
What I am trying to do is to read the csv and change the ...
1
vote
2answers
111 views
How to change user with authentication inside shell script
It is possible to change the user within a shell script by su - newuser; but what if the newuser needs authentication. How can I provide the password within the shell script?
None of the users is ...