input,scripting,path,arguments,sh , Bourne shell, script to compile file path then to pass it to a program


Bourne shell, script to compile file path then to pass it to a program

Question:

Tag: input,scripting,path,arguments,sh

There is a program to be called from command line, no GUI. Results of its operation are sent to disk. Program consumes a file path as one of its input arguments. Furthermore several option values are passed to this program as input arguments as well. All this along with Bourne shell on embedded linux based device.

The file path includes white spaces so it needs to be quoted. In most its sections it will practically never change. However there are few sections in the path (a sub-directory of certain level and parts of file name) which will change program invocation by invocation.

The program is going to be invoked from a script instead of directly from shell to avoid typing of all the input arguments on every call. The script should also help to parameterize the file path. Means non-fixed sections of file path are to be passed to script as its input argument, the script's job will be to compile whole file path from received input argument and the fixed strings and call the program with all required input values.

Now imagine please the program's name is curl. And the path is an URL to a download file on mozilla ftp server. Script in its current version accomplishes the job in following fashion.

curl --remote-name-all --user use:passk 'ftp://ftp.mozilla.org/pub/firefox/releases/'$1'/win32/en-US/Firefox Setup '$1'.exe'

--remote-name-all is of little significance here --user use:passk is of little significance here

It produces results as expected. However I am not sure if this is the state of the art to accomplish the aimed goal. Also what are the caveats of this solution?


Answer:

The shell quoting is weird and not portable, better use :

curl --remote-name-all \
    --user use:passk \
    "ftp://ftp.mozilla.org/pub/firefox/releases/$1/win32/en-US/Firefox%20Setup%20$1.exe"

%20 is an URI escape for space (if not a typo in your post).


Related:


Read graphs from file as fast as possible


c,input,graph,text-files
I have a txt file that contains 2 graphs and the number of vertices in the following format: 6 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 1 0 0 1 0 1 0 1 0 0 0 0 1 0 1 0...

Limit number of characters in input


javascript,html,input,limit,onkeypress
How do I limit the number of characters in my input? In the following code I want max 14 characters. <script language='JavaScript'> function SomenteNumero(e){ var tecla=(window.event)?event.keyCode:e.which; if((tecla>47 && tecla<58)) return true; else{ if (tecla==8 || tecla==0) return true; else return false; } } </script> <input type='text' size='10' value='' onkeypress='return SomenteNumero(event)'>...

Finding the average of a column excluding certain rows using AWK


linux,bash,awk,scripting
I want to calculate the average of the 5th column (last column) excluding the rows with the value "9999". Would appreciate your feedback. 77.300 16 1 3.6112914285714268 9.4 77.300 16 2 -0.001737142857145102 20.0 77.300 16 3 5.1570742857142857 8.9 77.300 17 0 3.6112914285714268 8.9 77.300 17 1 2.9484342857142849 11.7 77.300 17...

Set focus for paper-input via radio button


input,radio-button,focus,polymer,paper-elements
In Polymer (1.0), how can I set the focus of the iron-input when (as example) radiobutton 'radio1' is selected. <div> <div>Title:</div> <paper-radio-group> <paper-radio-button name="radio1">Radio1Label</paper-radio-button> <paper-radio-button name="radio2">Radio2Label</paper-radio-button> </paper-radio-group> <paper-input-container> <input is="iron-input"> </paper-input-container> </div> ...

Deleting upto a line


bash,perl,shell,sed,scripting
I have a line that looks like: foo cat dog = -48.34277635 foo(horse->0) = -60.34277635 and I only want the last set of numbers: -60.34277635 The line is formatted with that exact spacing. I've looked everywhere for a simpler solution, but I can't find anything without chopping the file piece...

full text search with multiple text input


sql,laravel,input,full-text-search,laravel-5
I'm trying to do a full text search with two text input fields. public function searchmatch() { $hex = Input::get('HEX'); $rgb = Input::get('RGB') $products = DB::table('products')->whereRaw( "MATCH(HEX,RGB) AGAINST(? IN BOOLEAN MODE)", array($hex,$rgb) )->get(); return view('search')->with('products', $products); } However it does not work. I tried storing both inputs into an array...

Use angular-ui timepicker as input form


angularjs,input,angular-ui-bootstrap,timepicker
I'm using angular-ui timepicker according to the example here. This is my HTML: <timepicker data-ng-model="hour" data-ng-change="changed()" data-hour-step="1" data-minute-step="5" data-show-meridian="ismeridian"></timepicker> In the js file, I'm trying to get the value with var start_hour = { hour:new Date($scope.hour).getHours(), min:new Date($scope.hour).getMinutes() }; But it's only works if I set a new date in...

Input value is not respecting padding and breaking container


html,css,input
I'm doing a contact form with a <input type="submit"> to submit the form. I set a padding to my input and I have a large text value. My design is responsive. In mobile my input is set to the 100% of the container, but the text value in the input...

BIOS level programming


scripting,boot,bios,low-level
I am trying to write a script that is executed before Windows is booted on my Computer. I have already developed a simple Linux bash script to accomplish this, but I would like to improve and take it further. The problem with using a Linux script is that it adds...

font-awesome to be inserted in value=“”>


spring,button,input,font-awesome
im trying to insert some font-awesome inside here <form action="/someweb.html"> <input type="submit" class="btn btn-success" value="<spring:message text="View List"/>"> </form> but it seems that this code <i class="fa fa-list-ul fa-lg"></i> wont fit inside, and i tried to insert it inside in different position, i always get failed result. all i wanted is...

Rearranging a csv file


bash,shell,csv,awk,scripting
I have a file with contents similar to the below Boy,Football Boy,Football Boy,Football Boy,Squash Boy,Tennis Boy,Football Girl,Tennis Girl,Squash Girl,Tennis Girl,Tennis Boy,Football How can I use 'awk' or similar to rearrange this to the below: Football Tennis Squash Boy 5 1 1 Girl 0 3 1 I'm not even sure if...

Inputting integers in to an array Error?


java,arrays,input,value
The purpose of my code is to display the student number and their respective grade as follows: Student Grade 1 53 2 45 So on... I used a 5x2 array, in which the user can input the values for the grade... However I run in to a problem, when inputting...

Powershell Data input [closed]


powershell,input,data
I'm looking to make a super simple request for input script that uses said input to be executed in the script below. I can edit the script before I run it each time, but it would be way cooler and more practical if you could just enter the PCname and...

Parsing the text file line-by-line using batch script (batch file)


windows,batch-file,scripting,cmd
So, I am programming in the batch script and I came across this issue. The following code will take yourwords.txt file and parse it. The existedWord variable will have the last word of the text file. So, everytime when I run this program it will only compare the user's input...

jQuery: Clear input field if it is not filled in certain time? [closed]


javascript,jquery,input,time
Using jquery or js, how can I clear an input field if it doesn't reach x amount of characters in a certain time? Basically, if an input field doesn't reach 10 characters in 1 second, I want to clear any input that was typed. How can I calculate the time...

input errors : split part of one entery


c++,input,io
i am doing some practice on standard I/O i have a complex class . my class has overloaded insertion and extraction operators ,the input should of the form : x + yi(e.g 10 + 9i) i have to determine if input is valid or not . there is the problem...

Converting a Shell Script Into a *.app File


osx,shell,scripting,executable,desktop
Using Automator.app and Platypus.app, I have been able to bundle a simple shell script I created to power cycle wi-fi on my MacBook Pro. Both resulting apps run properly, but have one glaring issue that I want to correct: The apps reference the shell script from outside of the program....

How to perferm different action depending on user input


java,input,user
I'm trying to make a really simple game (even without an interface). You are supposed to type what action would you like to do attack, heavy and light or block). But "enemy" responds only to "light" action. What is the problem? import java.util.Scanner; public class Game { public static void...

Expect script for checking ssh connection for a list of ips


shell,ssh,scripting,expect
Can anyone help me in creating an expect script to just do an SSH on a list of servers and check if it was fine. I do not need to interact, do not need to fire any command on each server, I just want to do an ssh and come...

Make the input wait for mouse or keyboard - Assembly Language


assembly,input,keyboard,mouse,simultaneous
I fixed my program, but now the loop seems to be stuck. Whenever I press u or d, it is stuck, but the mouse part works :) ; You may customize this and other start-up templates; ; The location of this template is c:\emu8086\inc\0_com_template.txt org 100h CLEAR MACRO MOV AX,0600H...

Check if the number entered is in array, otherwise add to the array


java,arrays,validation,input,user
The user will enter the size of the array and its values. If the entered value exists, the user must enter a different number. I can't seem to construct the proper code to check if the inserted value exists. public static void main(String[] args) { String holder="", s; int size;...

How can I set the value of an input (textbox) using jQuery?


jquery,html,input
I've got this input element: <input type="text" id="txtbxYear"> ...and this jQuery to retrieve the current year: var now = new Date(); var year = now.getFullYear(); ...and have tried all of the following to set the value of the "textbox" to the current year: $( "#txtbxYear" ).html(year); $( "#txtbxYear" ).val(year); $(...

Laravel 5 getting input values that are arrays


php,laravel,input,laravel-5,laravel-form
I have a text field like {!! Form::textarea('representive[address_1]' ,null ,['class' =>'textboxlong form-control','style'=>'height:60px;']) !!} In my form. And when i try to get its value in my controller but it comes null. What i try is $adress = Request::get('representive.0.address_1'); I also tried some other ways but could not end up with...

Reading rsync source from file results in improper parsing of file names with white space


bash,shell,unix,scripting,rsync
I wrote a simple script that searches through a specific directory defined by the variable "SCOPE" producing a list of directories that were modified within the past 24 hours printing them to a temp file. The first line of the file is deleted (to exclude the root level of the...

Keydown function to prevent letters - How to load function before key is entered


javascript,jquery,input,internet-explorer-8
I've taken a code snippet from a different closed post, which mainly works well, apart from one aspect. I have an input field which I need to be numeric only I need to allow for the use of a full stop The code below works fantastically in allowing the above...

Simplifying some jQuery code of keyup inputs


javascript,jquery,css,input,keyup
Thing that I'm making I am making a webpage, which is to generate forum code automatically when I enter content into inputs. Each character will be in different colors and the sentence will look like a gradient. This is the jsfiddle sample. When I enter a-p-p-l-e in to those inputs,...

Flask submit data outside of form input fields


python,forms,input,flask,args
I'm working with Flask, and I am trying to submit some data that is not in input fields, to be added to the database. jinja code with the form(s) looks like this: {% for item in items %} <tr> <form id="adauga_{{ item.stoc_id }}" action="{{ url_for('adauga') }}" method="POST"> <td>{{ item.stoc_id }}</td>...

How to read propositional logic symbols as input using Java Scanner?


java,input,java.util.scanner
Scanner in = new Scanner(System.in,"UTF-8"); System.out.println(in.next()); If I paste ∧, I receive ? as output to the console. Can someone explain what I can do to properly read logic symbols like this? I'm using NetBeans 8.0.1. Thanks....

Count amount of inputfields with the same name in PHP?


php,input,count
I want to count the amount of inputfields with the name "termin"+number+"_von". So if there is one Inputfield with the name "termin1_von", a secound with the name "termin2_von" and third with the name "termin3_von" the code should print "123". cause there are 3 Inputs. What I want is that I...

Css styling of initial default value of a text field


html,css,input,fonts
I have a html input textfield as follows: <input type="text" name="fName" class="inpField" size="20" value="First Name *" /> Now I want to do selective styling of some text as follows: I have the default value set as "First Name *". Using css- I want to apply a global style to that...

Using excel as inputfile in vba (scripting - non MS OFFICE)


vba,scripting
I'm developing a script in VBA (inside a workspace, not MS office program) that needs to use a small excel file as input. I want to use the data in the excel file and load it into a 2D array so that I can make decisions within my script based...

Detect when input text change


javascript,jquery,html,input
I am trying to style an input and an ul-li like select-option (as style below). And I am successfully change the value of input text if I click on a li. For example, the #main value will be 1 if I click on the first li or 2 on the...

Is it possible to run command “route -n” specifically for a NIC


linux,shell,scripting
I am fairly new to linux I wanted to ask if its possible in linux commands to run a "route -n" command to retrieve information for a specific NIC. E.G route -n ether0. Because currently it shows me for all the NIC's but what if I want just for one?...

How to make my output show only whats needed with my cheque generator program for c


c,input,output
I have made a program that can output whatever numeral is inputted in to it but it will convert it to words instead of just numerals for example if you input "1234.56" it will convert it to "One Thousand Two Hundred Thirty Four Dollars and ... 56 Cents". The cents...

searching a specific word from a list of words in batch file


batch-file,cmd,scripting
I have a %list% variable which has words (see the code) and I want to search a word which ends with letter 'Y' (ignoring the case-sensitive) and which starts with the last letter of user's input. User input would be any valid word. Once I find that specific word then...

Take input without changing the line


python,input
print("Please Enter:") x = input() print(x) In the console after "Please Enter:" is printed the line changes. I want that I should be able to provide input in the same line of "Please Enter:". Is there any method to prevent the change of line? ...

interpreting a script through F#


scripting,f#,interpreted-language
I really like F# but I feel like it's not succint and short enough. I want to go further. I do have an idea of how I'd like to improve it but I have no experience in making compilers so I thought I'd make it a scripting language. Then I...

What are valid input DATE formats for the (Linux) date command?


linux,bash,date,scripting
The following command generates the date for the next day: date -d "20150615 12:00 +1 day" +%Y%m%d 20150616 I would like to specify my own INPUT date format, such as: 2015_06_15 But the date command does not like this format and complains about invalid date: date: invalid date '2015_06_15 12:00...

jQuery and operation in real time


javascript,jquery,html,input
I have two input text and i want use jquery to do an operation with them. The input text are this: <p> <label>Title 1</label> <span class="field"> <input type="text" name="field1" id="field2" class="width100" value="<?php echo $field1t; ?>" /> </span> </p> <p> <label>Title 2</label> <span class="field"> <input type="text" name="field2" id="field2" class="width100" value="<?php echo...

I want to check the content of textarea must contains previous inputs' words using javascript


javascript,jquery,html,input,textarea
Is it possible to check the content of textarea must contain previous inputs' all words using javascript or jquery? and if not contains all words than the value of textarea is invalid or will not submit. Please reply me soon. Thanks....

Based On Styling Indesign Javascript Scripting CC


javascript,scripting,indesign,jsx
I would like to know how I can set ( either directly or some other alternative method ) the style property of "Based on" using javascript within adobe InDesign CC. If I could also ask for documentation leading to an answer for reference it would be immensely appreciated. My code:...

Scala: load different files by input


file,scala,input
My program has a lot of different functions and one of these is the command "load". As soon as the user types as input "load" he can load in a txt file... The problem is, that my command is not only the "load" word itself, its for example "load numbers.txt"...

Looping variables


perl,scripting
I'm working with perl to make a script that will work with Dot products/assorted vector math. I've got a working script ( Still very much in progress/needs refinement ) that will do what I ask. #!/usr/bin/perl use strict; use warnings; use diagnostics; use Math::Vector::Real; use 5.010; use Math::Trig; my $source...

adding text after prompt for input


java,input,cmd,prompt
I'm new to Java & I don't even know if what I'm trying to do is actually doable in cmd but I want to know if there's a way to ask the user for an input while displaying something at the right of the input, something like: enter weight: _...

How to Click All Inputs with the Same Class on Page Load


javascript,jquery,table,input,click
I have a table with multiple rows (hundreds) on my web page. Each table row has an input with the class name of act_inv. I am trying to get JavaScript/JQuery to click each input with the class name of act_inv. Is this possible? And if so, how may I do...

Html5 input type number formatting


android,iphone,html5,windows-phone-8,input
I have this page where i use the input type number. so that it will show the numeric keyboard on wp, android and ios device . But my problem is that if the user use a culture info on the device for. lets say Denmark. the numeric keyboard shown use...

Error while executing lsof from bash script


linux,bash,shell,scripting
I am trying to check for the process which are running on a particular port and if present kill them, as i have to start another process on that port. Below is my code snippet. #!/usr/bin/env bash TEST_CASE_PATH="$HOME/Projects"; #kill Previous Process Running on port 9130 OUTPUT="$(ls -1)" echo "${OUTPUT}" #...

Checking Blank User Input in Batch file (No Input) [duplicate]


windows,batch-file,cmd,scripting
This question already has an answer here: set /p empty answer crash 1 answer So, I am asking the user to make an selection. The point of this question is to catch if the user hit just entered without any input. My plan is to find out if the...

Java Append Key Input to String


java,string,input,keyboard,key
For my current project I need to create a custom text box that gets each key pressed and adds it to a string. I'm constantly updating the method that retrieves the key a user is pressing and then I add it like so: public void addCharacter(String c) { String before...

storing array from user and accessing it


arrays,assembly,input,user,mips
I have to create an int array based on user input, sum the integers, and output the sum and the array itself. My code calculates the sum correctly, but I cannot output the list. It only prints out the last number and zeros and then gets stuck in an infinite...