variable-expansion Questions
4
Solved
I have some variables in a bash script that may contain a file name or be unset. Their content should be passed as an additional argument to a program. But this leaves an empty argument when the va...
Nunnally asked 18/7, 2015 at 9:0
3
Before I asked, I did some googling, and was unable to find an answer.
The scenario I have is this:
A list of numbers are passed to the script, either \n-delimited via a file, or comma-delimited v...
Mcgray asked 12/5, 2015 at 20:47
2
Solved
Is there any way to reliably use an arbitrary globbing pattern that's stored in a variable? I'm having difficulty if the pattern contains both spaces and metacharacters. Here's what I mean. If I ha...
Gasper asked 24/10, 2014 at 18:34
4
Solved
I notice in most scripts, the two are usually in the same line as so:
SETLOCAL ENABLEDELAYEDEXPANSION
Are the two in fact separate commands and can be written on separate lines?
Will setting EN...
Anybody asked 13/7, 2011 at 13:44
1
Solved
I'm new in shell programming on macosx and have a little problem. I've written the following shell script:
#!/bin/sh
function createlink {
source_file=$1
target_file="~/$source_file"
if [[ -f $...
Dyslexia asked 18/5, 2013 at 9:50
1
Solved
I saw someone mention the reword function today, but documentation for it is very brief. It looks like shell script environment variable substitution, or maybe regex substitution, but different. Ho...
Gert asked 17/2, 2013 at 18:56
3
Solved
I have a small problem trying to unzip a file using the 7za
command-line utility in Powershell.
I set the $zip_source variable to the zip file's path and the
$unzip_destination to the desired outp...
Hephaestus asked 7/5, 2012 at 14:34
1
Solved
On this line:
GCCVER:=$(shell a=`mktemp` && echo $'#include <stdio.h>\nmain() {printf("%u.%u\\n", __GNUC__, __GNUC_MINOR__);}' | gcc -o "$a" -xc -; "$a"; rm "$a")
I get:
*** unter...
Saddler asked 12/8, 2011 at 6:24
8
Solved
I ran into ss64.com which provides good help regarding how to write batch scripts that the Windows Command Interpreter will run.
However, I have been unable to find a good explanation of the gramma...
Doublehung asked 4/11, 2010 at 7:38
3
Solved
I have a file called "physics 1b.sh". In bash, if I try
x="physics 1b"
grep "string" "$x".sh
grep complains:
grep: physics 1b: No such file or directory.
However, when I do
grep "string" phy...
Substandard asked 30/3, 2010 at 6:51
2
Solved
I have encountered a most annoying problem that occurs on the PWD variable when the current path includes a space. My code looks somewhat like this:
mycommand |sed -E '
s|mystuff|replacement| ;
s...
Chunchung asked 7/9, 2009 at 9:35
1
Solved
I have a file (directories.txt) with directory names, each on a single line and I like to expand the line
C:\Documents and Settings\%USERNAME%\My Documents
In my script to the real user name run...
Blackbeard asked 27/8, 2009 at 8:37
2
Solved
I'm trying to get a variable expanded in a command call. Here's what I have in my .vimrc:
command! -nargs=1 -complete=dir TlAddPm call s:TlAddPm(<f-args>)
function! s:TlAddPm(dir)
let flist...
Ahrendt asked 20/3, 2009 at 15:51
© 2022 - 2024 — McMap. All rights reserved.