In [1]:
arg1 = "first_argument"
arg2 = "second_argument"
arg3 = "third_argument"
arg4 = "fourth argument has spaces"
args = [arg1,
arg2,
arg3,
arg4,
]
In [2]:
# Probably the Right Way(tm)
!echo {arg3}
In [3]:
!echo $arg4
In [4]:
# Probably safer than above
!echo "$arg2"
In [5]:
# Can do python operations within the curly braces
for i in range(3):
!echo {i+1}
!echo
!echo "Split the string:" {arg3.split('_')[-1]} {args[2]}
print("")
In [6]:
%%bash -s "$arg1" "$arg2" {arg3}
echo "This bash script knows about $1 and $2 and $3."
In [7]:
year_htmls = !ls 2???.html
In [8]:
year_htmls
Out[8]:
In [9]:
type(year_htmls)
Out[9]:
In [10]:
[int(x.split('.')[0]) for x in year_htmls]
Out[10]:
In [ ]: